MSARmdl {MSTest} | R Documentation |
Markov-switching autoregressive model
Description
This function estimates a Markov-switching autoregressive model
Usage
MSARmdl(Y, p, k, control = list())
Arguments
Y |
(T x 1) vector with observational data. |
p |
integer for the number of lags to use in estimation. Must be greater than or equal to |
k |
integer for the number of regimes to use in estimation. Must be greater than or equal to |
control |
List with model options including:
|
Value
List of class MSARmdl
(S3
object) with model attributes including:
y: a
(T x 1)
matrix of observations.X: a
(T-p x p + const)
matrix of lagged observations with a leading column of1
s.x: a
(T-p x p)
matrix of lagged observations.fitted: a
(T x 1)
matrix of fitted values.resid: a
(T x 1)
matrix of residuals.inter: a
(k x 1)
vector of estimated intercepts of each process.mu: a
(k x 1)
vector of estimated means of each process.phi: estimates of autoregressive coefficients.
stdev: a
(k x 1)
vector of estimated standard deviation of each process.sigma: a
(k x 1)
estimated covariance matrix.theta: vector containing:
mu
andvech(sigma)
.theta_mu_ind: vector indicating location of mean with
1
and0
otherwise.theta_sig_ind: vector indicating location of variances with
1
and0
otherwise.theta_var_ind: vector indicating location of variances with
1
and0
otherwise. This is the same astheta_sig_ind
inMSARmdl
.theta_P_ind: vector indicating location of transition matrix elements with
1
and0
otherwise.stationary: Boolean indicating if process is stationary if
TRUE
or non-stationary ifFALSE
.n: number of observations (same as
T
).p: number of autoregressive lags.
q: number of series. This is always
1
inMSARmdl
.k: number of regimes in estimated model.
P: a
(k x k)
transition matrix.pinf: a
(k x 1)
vector with limiting probabilities of each regime.St: a
(T x k)
vector with smoothed probabilities of each regime at each timet
.deltath: double with maximum absolute difference in vector
theta
between last iteration.iterations: number of EM iterations performed to achieve convergence (if less than
maxit
).theta_0: vector of initial values used.
init_used: number of different initial values used to get a finite solution. See description of input
maxit_converge
.msmu: Boolean. If
TRUE
model was estimated with switch in mean. IfFALSE
model was estimated with constant mean.msvar: Boolean. If
TRUE
model was estimated with switch in variance. IfFALSE
model was estimated with constant variance.control: List with model options used.
logLike: log-likelihood.
AIC: Akaike information criterion.
BIC: Bayesian (Schwarz) information criterion.
Hess: Hessian matrix. Approximated using
hessian
and only returned ifgetSE=TRUE
.info_mat: Information matrix. Computed as the inverse of
-Hess
. If matrix is not PD then nearest PD matrix is obtained usingnearest_spd
. Only returned ifgetSE=TRUE
.nearPD_used: Boolean determining whether
nearPD
function was used oninfo_mat
ifTRUE
or not ifFALSE
. Only returned ifgetSE=TRUE
.theta_se: standard errors of parameters in
theta
. Only returned ifgetSE=TRUE
.trace: List with Lists of estimation output for each initial value used due to
use_diff_init > 1
.
References
Dempster, A. P., N. M. Laird, and D. B. Rubin. 1977. “Maximum Likelihood from Incomplete Data via the EM Algorithm.” Journal of the Royal Statistical Society. Series B 39 (1): 1–38..
Hamilton, James D. 1990. “Analysis of time series subject to changes in regime.” Journal of econometrics, 45 (1-2): 39–70.
See Also
Examples
# --------------------------- Use simulated process ----------------------------
set.seed(1234)
# Define DGP of MS AR process
mdl_ms2 <- list(n = 200,
mu = c(5,10),
sigma = c(1,4),
phi = c(0.5),
k = 2,
P = rbind(c(0.90, 0.10),
c(0.10, 0.90)))
# Simulate process using simuMSAR() function
y_ms_simu <- simuMSAR(mdl_ms2)
# Set options for model estimation
control <- list(msmu = TRUE,
msvar = TRUE,
method = "EM",
use_diff_init = 1)
# Estimate model
ms_mdl <- MSARmdl(y_ms_simu$y, p = 1, k = 2, control)
summary(ms_mdl)