kpss.test.RdComputes the Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test for the
null hypothesis that x is level or trend stationary.
kpss.test(x, null = c("Level", "Trend"), lshort = TRUE)To estimate sigma^2 the Newey-West estimator is used.
If lshort is TRUE, then the truncation lag parameter is
set to trunc(4*(n/100)^0.25), otherwise
trunc(12*(n/100)^0.25) is used. The p-values are interpolated
from Table 1 of Kwiatkowski et al. (1992). If the computed statistic
is outside the table of critical values, then a warning message is
generated.
Missing values are not handled.
A list with class "htest" containing the following components:
the value of the test statistic.
the truncation lag parameter.
the p-value of the test.
a character string indicating what type of test was performed.
a character string giving the name of the data.
D. Kwiatkowski, P. C. B. Phillips, P. Schmidt, and Y. Shin (1992): Testing the Null Hypothesis of Stationarity against the Alternative of a Unit Root. Journal of Econometrics 54, 159–178.
x <- rnorm(1000) # is level stationary
kpss.test(x)
#>
#> KPSS Test for Level Stationarity
#>
#> data: x
#> KPSS Level = 0.39009, Truncation lag parameter = 7, p-value = 0.08143
#>
y <- cumsum(x) # has unit root
kpss.test(y)
#> Warning: p-value smaller than printed p-value
#>
#> KPSS Test for Level Stationarity
#>
#> data: y
#> KPSS Level = 7.4202, Truncation lag parameter = 7, p-value = 0.01
#>
x <- 0.3*(1:1000)+rnorm(1000) # is trend stationary
kpss.test(x, null = "Trend")
#> Warning: p-value greater than printed p-value
#>
#> KPSS Test for Trend Stationarity
#>
#> data: x
#> KPSS Trend = 0.082535, Truncation lag parameter = 7, p-value = 0.1
#>