MS_Regress_Fit: Function to Estimate a Markov Switching Regression

Description Usage Arguments Value Note Author(s) References See Also Examples

Description

This function will estimate by maximum likelihood a univariate MS model based on input arguments

Usage

1
MS_Regress_Fit(dep, indep, S, k = 2, distIn = "Normal")

Arguments

dep

The dependent/explained variable (a vector)

indep

the independent/explanatory variables (a matrix)

S

Input argument which controls which indep variables switch (see documentation for more details)

k

Number of states in MS model (a positive integer, e.g. k=2)

distIn

Assumed distribution for residue ("Normal" or "t")

Value

Returns a S4 "MS_Model" object the following slots:

@filtProb

A matrix with the filtered probabilities from the Model

@smoothProb

A matrix with the smooth probabilities from the Model (Kim's algorithm)

@Coeff

A list structure with all estimated coefficients (see documentation for more details)

@CondMean

A matrix of fitted conditional means, conditional on the probabilities of t<a6>t

@Coeff_Std

A list with standard errors of coefficients (with same members as @Coeff)

@LL

The maximum log likelihood found by optimizing algorithm

@k

The number of states in MS model

@paramVec

Estimated parameters in vector notation (with the same values as @Coeff

@stateDur

The Expected duration of each regime

@nParameter

The number of parameters in the model

@nParameter

The number of parameters in the model

@sizeModel

A list with the size of the estimated model (see documentation for details)

@distrib

The distribution assumption ("Normal" or "t")

Note

A MatLab version of the code is also available. See matlab exchange site (http://www.mathworks.com/matlabcentral/fileexchange/15789)

Author(s)

Marcelo Perlin - ICMA/UK <marceloperlin@gmail.com>

References

ALEXANDER, C. (2008) 'Market Risk Analysis: Practical Financial Econometrics' Wiley
HAMILTON, J., D. (1994) 'Time Series Analysis' Princeton University Press
HAMILTON, J., D. (2005) 'Regime Switching Models' Palgrave Dictionary of Economic
KIM, C., J., NELSON, C., R. (1999) 'State Space Model with Regime Switching: Classical and Gibbs-Sampling Approaches with Applications' The MIT press

See Also

MS_Regress_Simul,MS_Regress_For,MS_Regress_Lik

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# defining some data (from package)

data(indep)
data(dep)

S<-c(1,0,0)	# where to switch (in this case in the olny indep)
k<-2		# number of states
distIn<-"Normal"#distribution assumption

myModel<-MS_Regress_Fit(dep,indep,S,k)	# fitting the model
print(myModel)	# printing output
plot(myModel)	# plotting output

fMarkovSwitching documentation built on May 2, 2019, 5:58 p.m.