| HMmdl {MSTest} | R Documentation |
Hidden Markov model
Description
This function estimates a Hidden Markov model with k regimes.
Usage
HMmdl(Y, k, control = list())
Arguments
Y |
a |
k |
integer determining 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 HMmdl (S3 object) with model attributes including:
y: a
(T x q)matrix of observations.fitted: a
(T x q)matrix of fitted values.resid: a
(T x q)matrix of residuals.mu: a
(k x q)matrix of estimated means of each process.stdev: List with
k(q x 1)vector of estimated standard deviation of each process.sigma: List with
k(q x q)estimated covariance matrix.theta: vector containing:
muandvech(sigma).theta_mu_ind: vector indicating location of mean with
1and0otherwise.theta_sig_ind: vector indicating location of variance and covariances with
1and0otherwise.theta_var_ind: vector indicating location of variances with
1and0otherwise.theta_var_ind: vector indicating location of transition matrix elements with
1and0otherwise.n: number of observations (same as
T).q: number of series.
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
thetabetween 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
TRUEmodel was estimated with switch in mean. IfFALSEmodel was estimated with constant mean.msvar: Boolean. If
TRUEmodel was estimated with switch in variance. IfFALSEmodel 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
hessianand 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
nearPDfunction was used oninfo_matifTRUEor 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.
Krolzig, Hans-Martin. 1997. “The markov-switching vector autoregressive model.”. Springer.