stat_hs: Compute the Hidalgo-Seo Statistic

Description Usage Arguments Details Value References Examples

Description

This function computes the Hidalgo-Seo statistic for a change in mean model.

Usage

1
2
3
stat_hs(dat, estimate = FALSE, corr = TRUE, get_all_vals = FALSE,
  custom_var = NULL, use_kernel_var = FALSE, kernel = "ba",
  bandwidth = "and")

Arguments

dat

The data vector

estimate

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

corr

If TRUE, the long-run variance will be computed under the assumption of correlated residuals; ignored if custom_var is not NULL or use_kernel_var is TRUE

get_all_vals

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

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

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

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)

Details

For a data set x_t with n observations, the test statistic is

\max_{1 ≤q s ≤q n - 1} (\mathcal{LM}(s) - B_n)/A_n

where \hat{u}_t = x_t - \bar{x} (\bar{x} is the sample mean), a_n = (2 \log \log n)^{1/2}, b_n = a_n^2 - \frac{1}{2} \log \log \log n - \log Γ (1/2), A_n = b_n / a_n^2, B_n = b_n^2/a_n^2, \hat{Δ} = \hat{σ}^2 = n^{-1} ∑_{t = 1}^{n} \hat{u}_t^2, and \mathcal{LM}(s) = n (n - s)^{-1} s^{-1} \hat{Δ}^{-1} ≤ft( ∑_{t = 1}^{s} \hat{u}_t\right)^2.

If corr is FALSE, then the residuals are assumed to be uncorrelated. Otherwise, the residuals are assumed to be correlated and \hat{Δ} = \hat{γ}(0) + 2 ∑_{j = 1}^{\lfloor √{n} \rfloor} (1 - \frac{j}{√{n}}) \hat{γ}(j) with \hat{γ}(j) = \frac{1}{n}∑_{t = 1}^{n - j} \hat{u}_t \hat{u}_{t + j}.

This statistic was presented in \insertCitehidalgoseo13CPAT.

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)

References

\insertAllCited

Examples

1
2
CPAT:::stat_hs(rnorm(1000))
CPAT:::stat_hs(rnorm(1000), corr = FALSE)

CPAT documentation built on May 1, 2019, 6:51 p.m.

Related to stat_hs in CPAT...