sim_hs_stat function

Hidalgo-Seo Statistic Simulation

Hidalgo-Seo Statistic Simulation

Simulates multiple realizations of the Hidalgo-Seo statistic.

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 long-run 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 gen_func

  • 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 TRUE to use kernel-based long-run variance estimation (FALSE means this is not employed); TODO: NOT CURRENTLY IMPLEMENTED

  • kernel: If character, the identifier of the kernel function as used in the cointReg (see documentation for cointReg::getLongRunVar); if function, the kernel function to be used for long-run variance estimation (default is the Bartlett kernel in cointReg); this parameter has no effect if use_kernel_var is FALSE; TODO: NOT CURRENTLY IMPLEMENTED

  • bandwidth: If character, the identifier of how to compute the bandwidth as defined in the cointReg package (see documentation for cointReg::getLongRunVar); if function, a function to use for computing the bandwidth; if numeric, the bandwidth to use (the default behavior is to use the if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="andrews91b;textual",package="CPAT",cached_env=.Rdpack.currefs) method, as used in cointReg); this parameter has no effect if use_kernel_var is FALSE; TODO: NOT CURRENTLY IMPLEMENTED

Returns

A vector of simulated realizations of the Hidalgo-Seo statistic

Details

If corr is TRUE, then the residuals of the data-generating process are assumed to be correlated and the test accounts for this in long-run variance estimation; see the documentation for stat_hs

for more details. Otherwise, the sample variance is the estimate for the long-run variance, as described in if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_citeOnly(keys="hidalgoseo13;textual",package="CPAT",cached_env=.Rdpack.currefs) .

Examples

CPAT:::sim_hs_stat(100) CPAT:::sim_hs_stat(100, gen_func = CPAT:::rchangepoint, args = list(changepoint = 250, mean2 = 1))

References

if(!exists(".Rdpack.currefs")) .Rdpack.currefs <-new.env();Rdpack::insert_all_ref(.Rdpack.currefs)

  • Maintainer: Curtis Miller
  • License: MIT + file LICENSE
  • Last published: 2018-12-25

Useful links