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 (T x 1) matrix of observations.

p

Integer determining the number of autoregressive lags.

control

List with test procedure options including:

  • ix: List of Markov Switching parameters. 1 = just mean c(1,2) = mean and first param, (default: 1).

  • msvar: Boolean indicator. If TRUE, there is a switch in variance. If FALSE only switch in mean is considered. Default is FALSE.

  • qbound: Indicator that bounds q by 1-p (default: FALSE).

  • gridsize: Integer determining the number of grid points for markov switching parameters. Default is 20.

  • pgrid_from: Double determining the initial grid point for transition probabilities. Default is 0.1.

  • pgrid_by: Double determining the step size for grid points of transition probabilities. This, along with p_gridsize will determine the bounds of search space. Default is 0.075.

  • pgrid_to: Double determining the end grid point for transition probabilities. Default is 0.925.

  • mugrid_from: Double determining the minimum value of mean in second regime. Default is 0.1.

  • mugrid_by: Double determining the step size for grid points of mean in second regime. This, along with gridsize will determine the max value of mean in second regime. Default is 0.1.

  • siggrid_from: Double determining the minimum value of sigma in second regime (if msvar = TRUE). Default is 0.1.

  • siggrid_by: Double determining the step size for grid points of sigma in second regime. This, along with gridsize will determine the max value of sigma in second regime. Default is 0.1.

  • N: Integer determining the number of replications. Default is 1000.

  • nwband: Integer determining maximum bandwidth in Bartlett kernel. Critical values and p-values are returned for each bandwidth from 0:nwband as suggested in Hansen (1996). Default is 4.

  • theta_null_low: Vector determining lower bound on parameters under the null hypothesis. Length of vector should be number of model coefficients + 1 for variance. Default is to only bound variance at 0.01.

  • theta_null_upp: Vector determining upper bound on parameters under the null hypothesis. Length of vector should be number of model coefficients + 1 for variance. Default is to no bounds (i.e. Inf).

  • optim_method: String determining the type of optimization procedure used. Allowed options are "gp-optim" for general purpose optimization using optim from stats or "nl-optim" using slsqp from nloptr. Default is "gp-optim".

Value

List of class HLRTest (S3 object) with model attributes including:

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)



[Package MSTest version 0.1.2 Index]