msvar: Markov-switching vector autoregression (MSVAR) estimator

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

View source: R/msvar.R

Description

Estimates a Markov-swtiching vector autoregression (MSVAR) model with h regimes (states) by maximum likelihood. The Hamilton filtering algorithm is used to estimate the regimes. The numerical optimization to compute the MLE is based on the block-wise algorithm of Sims, Waggoner and Zha (2008).

Usage

1
msvar(Y, p, h, niterblkopt = 10)

Arguments

Y

T x m multiple time series object created with ts()

.

p

Lag length, an integer

h

Number of regimes / states, an integer

niterblkopt

Number of iterations to allow for the block-wise optimization.

Details

This function computes ML estimates for an MSVAR(p,h) model where p is the number of lags and h is the number of regimes. The model is estimated using the block-wise algorithm of Sims, Waggoner, and Zha (2008). This ML optimization algorithm splits the parameter space of the MSVAR model into separate block components: (1) the transition matrix Q, (2) the intercepts, (3) the autoregressive coefficients, (4) the error covariances. The algorithm does 4 separate optimizations for each niterblkopt calls. Each component of the model is optimized separately over the niterblkopt values using separate calls to optim. Within each optim call, Fortran code is used to do the work of the filtering algorithm for the regimes in the model

Value

A list of class MSVAR and the appropriate inputs objects to feed the results into subsequent functions like gibbs.msbvar (though you should use msbvar and specify a prior!).

init.model

Description of 'comp1'

hreg

Description of 'comp2'

Q

h x h Markov transition matrix

fp

T x h Transition probability matrix

m

Integer, number of equations

p

Integer, number of lags

h

Integer, number of regimes

llfval

Vector of length niterblkopt

DirectBFGSLastSuccess

optim convergence code returned in the last optimization used in the last block-wise optimization

Note

Consult the msbvar function for more details on the model. This function is only included as a baseline or helper to the overall estimation goal of fitting MSBVAR models.

Author(s)

Patrick T. Brandt and Ryan Davis

References

Hamilton, James. 1989. "A new approach to the economic analysis of nonstationary time series and the business cycle." Econmetrica, 357–384.

Sims, Christopher A. and Daniel F. Waggoner and Tao Zha. 2008. "Methods for inference in large multiple-equation Markov-switching models" Journal of Econometrics 146(2):255–274.

See Also

msbvar for the Bayesian estimator, szbvar for the Bayesian, non-regime-switching version, gibbs.msbvar for posterior sampling.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# Simple replication of Hamilton (1989) as in
# Kim and Nelson (1999: 79, 220)

data(HamiltonGDP)
set.seed(1)

m2 <- msvar(HamiltonGDP, p=1, h=2, niterblkopt=20)

# Now plot the filtered probabilities of a recession
# Compare to Kim and Nelson (1999: 79, 220)

fp.rec <- ts(m2$fp[,1], start=tsp(gdp)[1], freq=tsp(gdp)[3])
plot(fp.rec)


## End(Not run)
 

MSBVAR documentation built on May 30, 2017, 1:23 a.m.

Related to msvar in MSBVAR...