stat_Zn: Compute the Rényi-Type Statistic

Description Usage Arguments Details Value Examples

Description

This function computes the Rényi-type statistic.

Usage

1
2
3
stat_Zn(dat, kn = function(n) {     floor(sqrt(n)) }, estimate = FALSE,
  use_kernel_var = FALSE, custom_var = NULL, kernel = "ba",
  bandwidth = "and", get_all_vals = FALSE)

Arguments

dat

The data vector

kn

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

estimate

Set to TRUE to return the estimated location of the change point

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

custom_var

Can be a vector the same length as dat consisting of variance-like numbers at each potential change point (so each entry of the vector would be the "best estimate" of the long-run variance if that location were where the change point occured) or a function taking two parameters x and k that can be used to generate this vector, with x representing the data vector and k the position of a potential change point; if NULL, this argument is ignored

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)

get_all_vals

If TRUE, return all values for the statistic at every tested point in the data set

Details

The definition of the statistic is

\max_{t_T ≤q t ≤q T - t_T} \hat{σ}_{t,T}^{-1} ≤ft|t^{-1}∑_{s = 1}^{t}X_s - (T - t)^{-1}∑_{s = t + 1}^{T} X_s \right|

The parameter kn corresponds to the trimming parameter t_T.

Value

If both estimate and get_all_vals are FALSE, the value of the test statistic; otherwise, a list that contains the test statistic and the other values requested (if both are TRUE, the test statistic is in the first position and the estimated change point in the second)

Examples

1
2
3
4
CPAT:::stat_Zn(rnorm(1000))
CPAT:::stat_Zn(rnorm(1000), kn = function(n) {floor(log(n))})
CPAT:::stat_Zn(rnorm(1000), use_kernel_var = TRUE, bandwidth = "nw",
               kernel = "bo")

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