Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sim_de_stat

Darling-Erdös Statistic Simulation


Description

Simulates multiple realizations of the Darling-Erdös statistic.

Usage

sim_de_stat(size, a = log, b = log, use_kernel_var = FALSE,
  kernel = "ba", bandwidth = "and", n = 500, gen_func = rnorm,
  args = NULL, parallel = FALSE)

Arguments

size

Number of realizations to simulate

a

The function that will be composed wit l(x) = (2 \log(x))^{1/2}

b

The function that will be composed with u(x) = 2 \log(x) + \frac{1}{2} \log(\log(x)) - \frac{1}{2}\log(pi)

use_kernel_var

Set to TRUE to use kernel-based long-run variance estimation (FALSE means this is not employed)

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

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 Andrews (1991) method, as used in cointReg); this parameter has no effect if use_kernel_var is FALSE

n

The sample size for each realization

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

parallel

Whether to use the foreach and doParallel packages to parallelize simulation (which needs to be initialized in the global namespace before use)

Details

If use_kernel_var is set to TRUE, long-run variance estimation using kernel-based techniques will be employed; otherwise, a technique resembling standard variance estimation will be employed. Any technique employed, though, will account for the potential break points, as described in Rice et al. (). See the documentation for stat_de for more details.

The parameters kernel and bandwidth control parameters for long-run variance estimation using kernel methods. These parameters will be passed directly to stat_de.

Value

A vector of simulated realizations of the Darling-Erdös statistic

References

Andrews DWK (1991). “Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimation.” Econometrica, 59(3), 817-858.

Rice G, Miller C, Horváth L (????). “A new class of change point test of Rényi type.” in-press.

Examples

CPAT:::sim_de_stat(100)
CPAT:::sim_de_stat(100, use_kernel_var = TRUE,
                   gen_func = CPAT:::rchangepoint,
                   args = list(changepoint = 250, mean2 = 1))

CPAT

Change Point Analysis Tests

v0.1.0
MIT + file LICENSE
Authors
Curtis Miller [aut, cre]
Initial release
2018-12-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.