HLRTest {MSTest} | R Documentation |
Hansen (1992) likelihood ratio test
Description
This function performs Hansen's likelihood ratio test as described in Hansen (1992). Original source code can be found here.
Usage
HLRTest(Y, p, control = list())
Arguments
Y |
A ( |
p |
Integer determining the number of autoregressive lags. |
control |
List with test procedure options including:
|
Value
List of class HLRTest
(S3
object) with model attributes including:
mdl_h0: List with restricted model attributes. This will be of class
ARmdl
(S3
object). SeeARmdl
.LR0: Likelihood ratio test statistic value.
LRN: A (
N x 1
) vector with simulated LRT statistics under null hypothesis.pval: P-value.
LR_cv: A (
nwband x 3
) matrix with 90%, 95%, and 99% critical values in each column respectively.coef: Vector of coefficients from restricted model and grid search that maximized standardized LRT.
control: List with test procedure options used.
References
Hansen, Bruce E. 1992. “The likelihood ratio test under nonstandard conditions: testing the Markov switching model of GNP.” Journal of applied Econometrics 7 (S1): S61–S82.
Hansen, Bruce E. 1996. “Erratum: The likelihood ratio test under nonstandard conditions: testing the Markov switching model of GNP.” Journal of applied Econometrics 7 (S1): S61–S82.
Examples
# --------------------------- Use simulated process ----------------------------
set.seed(1234)
# Define DGP of MS AR process
mdl_ms2 <- list(n = 200,
mu = c(5,1),
sigma = c(1,1),
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)
hlrt_control <- list(ix = 1,
gridsize = 5,
p_gridsize = 9,
p_stepsize = 0.1,
mugrid_from = 0,
mugrid_by = 1)
hlrt <- HLRTest(y_ms_simu$y, p = 1, control = hlrt_control)
summary(hlrt)