Learn R Programming

MSTest (version 0.1.9)

LR_samp_dist_par: Monte Carlo Likelihood Ratio Test sample distribution (parallel version)

Description

This function simulates the sample distribution under the null hypothesis using parallel workers.

Usage

LR_samp_dist_par(
  mdl_h0,
  k1,
  N,
  burnin,
  Z,
  mdl_h0_control,
  mdl_h1_control,
  workers,
  seed = NULL,
  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.

Z

Exogenous regressors matrix or NULL.

mdl_h0_control

List with controls/options used to estimate restricted model.

mdl_h1_control

List with controls/options used to estimate unrestricted model.

workers

Integer determining the number of parallel workers. If workers > N, the effective count is silently capped at N (more workers than simulations provides no speedup and can thin the pre-drawn buffer below its retry budget).

seed

Optional integer seed for reproducible parallel RNG (L'Ecuyer-CMRG). Default is NULL (random but independent streams).

predrawn_eps

Optional list of pre-drawn standard normal matrices for fixed-error simulation (Dufour 2006, Prop. 4.2). Each element is a (T+burnin) x q matrix. Default is NULL (draw fresh innovations).

predrawn_state_rand

Optional matrix of pre-drawn U[0,1] for state transitions. Columns correspond to simulation draws. Default is NULL (only needed when null model has multiple regimes).

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.