sim_hs_stat {CPAT}  R Documentation 
HidalgoSeo Statistic Simulation
Description
Simulates multiple realizations of the HidalgoSeo statistic.
Usage
sim_hs_stat(size, corr = TRUE, gen_func = rnorm, args = NULL,
n = 500, parallel = FALSE, use_kernel_var = FALSE, kernel = "ba",
bandwidth = "and")
Arguments
size 
Number of realizations to simulate 
corr 
Whether longrun variance should be computed under the assumption of correlated residuals 
gen_func 
The function generating the random sample from which the statistic is computed 
args 
A list of arguments to be passed to 
n 
The sample size for each realization 
parallel 
Whether to use the foreach and doParallel packages to parallelize simulation (which needs to be initialized in the global namespace before use) 
use_kernel_var 
Set to 
kernel 
If character, the identifier of the kernel function as used in
the cointReg (see documentation for

bandwidth 
If character, the identifier of how to compute the bandwidth
as defined in the cointReg package (see
documentation for 
Details
If corr
is TRUE
, then the residuals of the datagenerating
process are assumed to be correlated and the test accounts for this in
longrun variance estimation; see the documentation for stat_hs
for more details. Otherwise, the sample variance is the estimate for the
longrun variance, as described in Hidalgo and Seo (2013).
Value
A vector of simulated realizations of the HidalgoSeo statistic
References
Andrews DWK (1991). “Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimation.” Econometrica, 59(3), 817858.
Hidalgo J, Seo MH (2013). “Testing for structural stability in the whole sample.” Journal of Econometrics, 175(2), 84  93. ISSN 03044076, doi: 10.1016/j.jeconom.2013.02.008, http://www.sciencedirect.com/science/article/pii/S0304407613000626.
Examples
CPAT:::sim_hs_stat(100)
CPAT:::sim_hs_stat(100, gen_func = CPAT:::rchangepoint,
args = list(changepoint = 250, mean2 = 1))