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
σ^T,t2=T−1(∑s=1t(Xs−Xˉt)2+∑s=t+1T(Xs−X~T−t)2), where
Xˉt=t−1∑s=1tXs and
X~T−t=(T−t)−1∑s=t+1TXs; 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 xt with n observations, the test statistic is
max1≤s≤n−1(LM(s)−Bn)/An
where u^t=xt−xˉ (xˉ is the sample mean),
an=(2loglogn)1/2, bn=an2−21logloglogn−logΓ(1/2), An=bn/an2, Bn=bn2/an2, Δ^=σ^2=n−1∑t=1nu^t2, and LM(s)=n(n−s)−1s−1Δ^−1(∑t=1su^t)2.
If corr is FALSE, then the residuals are assumed to be
uncorrelated. Otherwise, the residuals are assumed to be correlated and
Δ^=γ^(0)+2∑j=1⌊n⌋(1−nj)γ^(j) with γ^(j)=n1∑t=1n−ju^tu^t+j.
This statistic was presented in (Hidalgo and Seo 2013).
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)