This function computes the Monte Carlo P-value.
MCpval(test_stat, null_vec, type = "geq")MC p-value of test
Test statistic under the alternative (e.g. S_0).
A (N x 1) vector with test statistic under the null hypothesis.
String determining the type of test. Options are "geq" (right/upper-tail test; the default), "leq" (left/lower-tail test), "two-tailed" (or "two-tail"; two-sided test), and "absolute" (or "abs"; the upper-tail rule, intended for non-negative statistics). An unrecognized value raises an error.
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.
Dufour, Jean-Marie, and Richard Luger. 2017. "Identification-robust moment-based tests for Markov switching in autoregressive models". Econometric Reviews, 36(6-9), 713-727.