KPSS.test: KPSS tests for stationarity

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/KPSS.test.R


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)



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.


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, …, T} is assumed to be decomposed as

y[t] = ρ t + ξ_t + e_t,

that is, as the sum of a deterministic trend, a random walk (ξ_t), and a stationary error ( e[t] ~ N(0, σ^2[z])). Hence, this test reduces to simply test the hypothesis that {ξ_t} is stationary, that is, Ho: σ^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 σ^2. The test statistic is given by

η = ∑_i S^2_i / (T^2 * σhat^2(l)) = ∑_i S^2_i / (T^2 * s^2(l)).

where s^2(l) is a consistent estimate of σhat^2, given by

s^2(l) = (1/T) ∑_t e^2[t] + (2 / T) ∑_{s = 1}^l w(s, l) ∑_{t = s + 1}^T e[t] e[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 * T^{1/2} / 11, or else, 9 * T^{1/2} / 11, if trunc.l = "large".

Note, here the errors, e[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 η.


A list with the following:

1) Test statistic and P-value,

2) Critical values,

3) Residuals, e[t].


There is no standard methodology to select an appropriate value for trunc.l, however, satisfactory results have been found for trunc.l proportional to T^{1/2}. See Andrews, D.W.K. (1991) for a discussion on this. Empirically, this parameter may be suggested by the problem in turn, and should be large enough to approximate the true dynamic behaviour of the series.


Victor Miranda.


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

See Also



test <- KPSS.test(rnorm(20), type.H0 = "trend")


Example output

Loading required package: stats4
Loading required package: VGAM
Loading required package: splines

     =====    VGAMextra 0.0-2    ===== 

Additions and extensions of the package VGAM.
For more on VGAMextra, visit

For a short description, fixes/bugs, and new
features type vgamextraNEWS().

 H0: trend stationary vs. H1: Unit root. 
      Test statistic: 0.05817897 

p-value: 0.3815252
Upper tail percentiles:
                  10%    5%  2.5%    1%
Critical value  0.119 0.146 0.176 0.216
[1] "list"
                  10%    5%  2.5%    1%
Critical value  0.119 0.146 0.176 0.216

VGAMextra documentation built on May 24, 2021, 9:07 a.m.