stat_hs {CPAT} | R Documentation |
Compute the Hidalgo-Seo Statistic
Description
This function computes the Hidalgo-Seo statistic for a change in mean model.
Usage
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 |
corr |
If |
get_all_vals |
If |
custom_var |
Can be a vector the same length as |
use_kernel_var |
Set to |
kernel |
If character, the identifier of the kernel function as used in
cointReg (see |
bandwidth |
If character, the identifier for how to compute the
bandwidth as defined in cointReg (see
|
Details
For a data set x_t
with n
observations, the test statistic is
\max_{1 \leq s \leq 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 \Gamma (1/2)
, A_n = b_n / a_n^2
, B_n =
b_n^2/a_n^2
, \hat{\Delta} = \hat{\sigma}^2 = n^{-1} \sum_{t = 1}^{n}
\hat{u}_t^2
, and \mathcal{LM}(s) = n (n - s)^{-1} s^{-1}
\hat{\Delta}^{-1} \left( \sum_{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{\Delta} = \hat{\gamma}(0) + 2 \sum_{j = 1}^{\lfloor \sqrt{n}
\rfloor} (1 - \frac{j}{\sqrt{n}}) \hat{\gamma}(j)
with \hat{\gamma}(j)
= \frac{1}{n}\sum_{t = 1}^{n - j} \hat{u}_t \hat{u}_{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)
References
Hidalgo J, Seo MH (2013). “Testing for structural stability in the whole sample.” Journal of Econometrics, 175(2), 84 - 93. ISSN 0304-4076, doi: 10.1016/j.jeconom.2013.02.008, http://www.sciencedirect.com/science/article/pii/S0304407613000626.
Examples
CPAT:::stat_hs(rnorm(1000))
CPAT:::stat_hs(rnorm(1000), corr = FALSE)