DE.test: Darling-Erdös Test

Description Usage Arguments Value References Examples

Description

Performs the (univariate) Darling-Erdös test for change in mean, as described in \insertCitehorvathricemiller19CPAT. This is effectively an interface to stat_de; see its documentation for more details. p-values are computed using pdarling_erdos, which represents the limiting distribution of the test statistic under the null hypothesis when a and b are chosen appropriately. (Change those parameters at your own risk!)

Usage

1
2
DE.test(x, a = log, b = log, use_kernel_var = FALSE,
  stat_plot = FALSE, kernel = "ba", bandwidth = "and")

Arguments

x

Data to test for change in mean

a

The function that will be composed with 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 π

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

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

\insertAllCited

Examples

1
2
DE.test(rnorm(1000))
DE.test(rnorm(1000), use_kernel_var = TRUE, kernel = "bo", bandwidth = "nw")

ntguardian/CPAT documentation built on May 22, 2019, 2:20 p.m.