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

HR.test

Rényi-Type Test


Description

Performs the (univariate) Rényi-type test for change in mean, as described in (Rice et al. ). This is effectively an interface to stat_Zn; see its documentation for more details. p-values are computed using pZn, which represents the limiting distribution of the test statistic under the null hypothesis, which represents the limiting distribution of the test statistic under the null hypothesis when kn represents a sequence t_T satisfying t_T \to ∞ and t_T/T \to 0 as T \to ∞. (log and sqrt should be good choices.)

Usage

HR.test(x, kn = log, use_kernel_var = FALSE, stat_plot = FALSE,
  kernel = "ba", bandwidth = "and")

Arguments

x

Data to test for change in mean

kn

A function corresponding to the trimming parameter t_T; by default, the square root function

use_kernel_var

Set to TRUE to use kernel methods for long-run variance estimation (typically used when the data is believed to be correlated); if FALSE, then the long-run variance is estimated using \hat{σ}^2_{T,t} = T^{-1}≤ft( ∑_{s = 1}^t ≤ft(X_s - \bar{X}_t\right)^2 + ∑_{s = t + 1}^{T}≤ft(X_s - \tilde{X}_{T - t}\right)^2\right), where \bar{X}_t = t^{-1}∑_{s = 1}^t X_s and \tilde{X}_{T - t} = (T - t)^{-1} ∑_{s = t + 1}^{T} X_s; if custom_var is not NULL, this argument is ignored

stat_plot

Whether to create a plot of the values of the statistic at all potential change points

kernel

If character, the identifier of the kernel function as used in cointReg (see getLongRunVar); if function, the kernel function to be used for long-run variance estimation (default is the Bartlett kernel in cointReg)

bandwidth

If character, the identifier for how to compute the bandwidth as defined in cointReg (see getBandwidth); if function, a function to use for computing the bandwidth; if numeric, the bandwidth value to use (the default is to use Andrews' method, as used in cointReg)

Value

A htest-class object containing the results of the test

References

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

Examples

HR.test(rnorm(1000))
HR.test(rnorm(1000), use_kernel_var = TRUE, kernel = "bo", bandwidth = "nw")

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.