LMCLRTest function

Monte Carlo Likelihood Ratio Test

Monte Carlo Likelihood Ratio Test

This function performs the Local Monte Carlo likelihood ratio test (LMC-LRT) proposed in Rodriguez-Rondon & Dufour (2024). As discussed in their work, this test can be applied in very general settings and can be used to compare varioous regimes under the null and under the alternative.

LMCLRTest(Y, p, k0, k1, Z = NULL, control = list())

Arguments

  • Y: Series to be tested. Must be a (T x q) matrix where T is the number of time observations and q is the number of variables.

  • p: Number of autoregressive lags. Must be greater than or equal to 0.

  • k0: Number of regimes under null hypothesis. Must be greater than or equal to 1.

  • k1: Number of regimes under alternative hypothesis. Must be greater than k0.

  • Z: Exogenous regressors. Optional input and default is NULL. When used, it should be a (T x qz) matrix where T is the number of time observations and q is the number of exogenous variables.

  • control: List with test procedure options including:

    • N: Integer determining the number of Monte Carlo simulations. Default is set to 99 as in paper.
    • burnin: Number of simulated observations to remove from beginning. Default is 100.
    • converge_check: String or NULL determining if convergence of model(s) should be verified. Allowed inputs are: "null", "alt", "both", or NULL. If NULL (default) no model convergence is verified.
    • workers: Integer determining the number of workers to use for parallel computing version of test. Note that parallel pool must already be open. Default is 0.
    • mdl_h0_control: List with restricted model options. See Nmdl, ARmdl, VARmdl, HMmdl, MSARmdl, or MSVARmdl documentation for available and default values.
    • mdl_h1_control: List with unrestricted model options. See HMmdl, MSARmdl, or MSVARmdl documentation for available and default values.
    • use_diff_init_sim: Value which determines the number of initial values to use when estimating models for null distribution. Default is set to use the same as specified in mdl_h0_control and mdl_h1_control.

Returns

List of class LMCLRTest (S3 object) with attributes including:

  • mdl_h0: List with restricted model attributes.
  • mdl_h1: List with unrestricted model attributes.
  • LRT_0: Value of test statistic from observed data.
  • LRN: A (N x 1) vector of test statistics from data simulated under the null hypothesis.
  • pval: P-value of Local Monte Carlo Likelihood Ratio Test.
  • LRN_cv: Vector with 90%, 95%, and 99% Monte Carlo simulated critical values (from vector LRN). These are not asymptotic critical values.
  • control: List with test procedure options used.

Examples

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) # ------ MS-AR example ----- # # Set test procedure options lmc_control = list(N = 19, burnin = 100, converge_check = NULL, mdl_h0_control = list(const = TRUE, getSE = TRUE), mdl_h1_control = list(msmu = TRUE, msvar = TRUE, getSE = TRUE, method = "EM", use_diff_init = 1)) lmctest <- LMCLRTest(y_ms_simu$y, p = 1, k0 = 1 , k1 = 2, control = lmc_control) summary(lmctest)

References

Rodriguez-Rondon, Gabriel and Jean-Marie Dufour. 2022. "Simulation-Based Inference for Markov Switching Models” JSM Proceedings, Business and Economic Statistics Section: American Statistical Association.

Rodriguez-Rondon, Gabriel and Jean-Marie Dufour. 2024. “Monte Carlo Likelihood Ratio Tests for Markov Switching Models.” Unpublished manuscript.

  • Maintainer: Gabriel Rodriguez Rondon
  • License: GPL (>= 2)
  • Last published: 2025-02-24