The Kwiatkowski-Phillips-Schmidt-Shin (KPSS)
test for the null hypothesis that the series \(x\) is
level
or trend
stationary
KPSS.test(x, type.H0 = c("level", "trend")[1],
trunc.l = c("short", "large")[1],
show.output = TRUE)
A list with the following:
1) Test statistic and P-value,
2) Critical values,
3) Residuals, \(\varepsilon_t\).
Numeric. A univariate series.
The null hypothesis to be tested: either level
or
trend
stationarity.
The lag truncation parameter. See below for more details.
Logical. Should the results be displyed? Default is
TRUE
.
Victor Miranda.
To test the null hypothesis that a univariate time series is level--stationary or stationary around a deterministic trend. The alternative states the existence of a unit root.
Under this methodology, the series, say \( \{ y_t;~t = 1, \ldots, T\} \) is assumed to be decomposed as $$y_t = \rho t + \xi_t + \varepsilon_t,$$ that is, as the sum of a deterministic trend, a random walk (\(\xi_t\)), and a stationary error (\(\varepsilon_t \sim N(0, \sigma^2_z)\). Hence, this test reduces to simply test the hypothesis that \(\{ \xi_t \} \) is stationary, that is, \(H_0: \sigma^2_z = 0.\)
The test statistic combines the one--sided Lagrange multiplier (LM) statistic and the locally best invariant (LBI) test statistic (Nabeya and Tanaka, (1988)). Its asymptotic distribution is discussed in Kwiatkowski et al. (1992), and depends on the `long--run' variance \(\sigma^2\). The test statistic is given by $$\eta = T^{-2} \sum_i S^2_i / \widehat{\sigma}^2= T^{-2} \sum_i S^2_i / s^2(l).$$
where \(s^2(l)\) is a consistent estimate of \(\sigma^2\), given by $$s^2(l) = (1/T)\sum_{t = 1}^T\varepsilon^2_t + (2 / T) \sum_{s = 1}^l w(s, l) \sum_{t = s + 1}^T \varepsilon_t \varepsilon_{t - s}.$$
Here, \(w(s, l) = 1 - s/(l + 1)\), where
l
is taken from trunc.l
, the
lag--truncation parameter. The choice "short"
gives the smallest integer not less than
\(3 \sqrt{T} / 11\), or else,
\(9 \sqrt{T} / 11\), if
trunc.l = "large"
.
Note, here the errors, \(\varepsilon_t\), are
estimated from the regression
\(x ~ 1\) (level) or \(x ~ 1 + t\) (trend), depending upon
the argument type.H0
.
Unlike other software using linear interpolates, here the p--values for both, trend and level stationarity, are interpolated by cubic spline interpolations from the tail critical values given in Table 1 in Kwiatkowski et al. (1992). The interpolation takes place on \(\eta\).
Andrews, D.W.K. (1991) Heteroskedasticiy and autocorrelation consistent covariance matrix estimation. Econometrica, 59, 817--858.
Kwiatkowski, D., Phillips, P.C.B., Schmidt, P., and Shin, Y. (1992) Testing the null hypothesis of stationarity against the alternative of a unit root. Journal of Econometrics, 54, 159--178.
Nabeya, S. and Tanaka, K. (1988) Asymptotic theory of a test for the constancy regression coefficients against the random walk alternative. Annals of Statistics, 16, 218--235.
Phillips, P.C.B. and Perron, P. (1988) Testing for a unit root in time series regression. Biometrika, 75, 335--346.
Phillips, P.C.B. (1987) Time series with unit roots. Econometrica, 55, 277--301
checkTS.VGAMextra
.
set.seed(2802)
test <- KPSS.test(rnorm(20), type.H0 = "trend")
class(test)
test$crit.value
Run the code above in your browser using DataLab