Learn R Programming

MSTest (version 0.1.9)

LR_samp_dist: Likelihood Ratio Test Statistic Sample Distribution

Description

This function simulates the sample distribution under the null hypothesis. When pre-drawn innovations are provided (for fixed-error MMC per Dufour 2006, Prop. 4.2), uses a buffer loop where each innovation is tried once; failed draws skip to the next slot. Falls back to fresh random draws if the buffer is exhausted.

Usage

LR_samp_dist(
  mdl_h0,
  k1,
  N,
  burnin,
  Z,
  mdl_h0_control,
  mdl_h1_control,
  predrawn_eps = NULL,
  predrawn_state_rand = NULL
)

Value

vector of simulated LRT statistics

Arguments

mdl_h0

List with restricted model properties.

k1

integer specifying the number of regimes under the alternative hypothesis.

N

integer specifying the number of replications.

burnin

integer specifying the number of observations to drop from beginning of simulation.

mdl_h0_control

List with controls/options used to estimate restricted model.

mdl_h1_control

List with controls/options used to estimate unrestricted model.

predrawn_eps

Optional list of pre-drawn standard normal matrices for fixed-error simulation. Each element is a (T+burnin) x q matrix. Default is NULL (generate fresh draws).

predrawn_state_rand

Optional (T+burnin) x N_buffer matrix of pre-drawn U[0,1] values for state transitions (only used when null model has k > 1). Default is NULL.

References

Rodriguez-Rondon, G., & Dufour, J.-M. 2026a. "Monte Carlo Likelihood-Ratio Tests for Markov Switching Models." Bank of Canada Staff Working Paper, No. 2026-23. doi: 10.34989/swp-2026-23.

Dufour, Jean-Marie. 2006. "Monte Carlo Tests with Nuisance Parameters: A General Approach to Finite-Sample Inference and Nonstandard Asymptotics." Journal of Econometrics 133(2): 443-477.