Nothing
# Example script for MS_Regress_Simul and MS_Regress_Fit (2 states, t distribution)
# The script will first simulate a markov switching process given the input and then fit it using MS_Regress_Fit
library(fMarkovSwitching) # Assuming library is installed
nr=200
distrib<-"t"
k<-2
PVec<-rbind(c(.9 ,.2),
c(.1 ,.8))
P<-matrix(PVec,k,k)
S<-c(1,0,0)
nS_param<-matrix(c(.5,-.2),2,1) # Setting up the coefficients at non switching parameters
S_param<-matrix(0,sum(S),k)
S_param[,1]= .2 # Setting up the coefficients at switching parameters
S_param[,2]=-.3
sigma<-matrix(0,1,k)
sigma[1,1]=.02 # Setting up the standard deviavion of the model at State 1
sigma[1,2]=.01 # Setting up the standard deviavion of the model at State 2
v<-matrix(0,1,k)
v[1,1]=10 # Setting up the degree of freedom (t distribution parameter) of the model at State 1
v[1,2]=5 # Setting up the degree of freedom (t distribution parameter) of the model at State 2
Coeff<-list(P=P ,
S=S ,
nS_param=nS_param ,
S_param=S_param ,
sigma=sigma ,
v=v)
mySimul<-MS_Regress_Simul(nr,Coeff,k,distrib)
print(mySimul)
plot(mySimul)
dep<-mySimul@dep
indep<-mySimul@indep
myModel<-MS_Regress_Fit(dep,indep,S,k,distrib)
print(myModel)
plot(myModel)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.