kpss.test: Kwiatkowski-Phillips-Schmidt-Shin Test

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

Description

Performs Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test for the null hypothesis that x is a stationary univariate time series.

Usage

1
kpss.test(x, lag.short = TRUE, output = TRUE)

Arguments

x

a numeric vector or univariate time series.

lag.short

a logical value indicating whether the parameter of lag to calculate the test statistic is a short or long term. The default is a short term. See details.

output

a logical value indicating to print out the results in R console. The default is TRUE.

Details

The Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test tends to decompose the time series into the sum of a deterministic trend, a random walk, and a stationary error:

x[t] = α*t + u[t] + e[t],

where u[t] satisfies u[t] = u[t-1] + a[t], and a[t] are i.i.d (0,σ^2). The null hypothesis is that σ^2 = 0, which implies x is a stationary time series. In order to calculate the test statistic, we consider three types of linear regression models. The first type (type1) is the one with no drift and deterministic trend, defined as

x[t] = u[t] + e[t].

The second type (type2) is the one with drift but no trend:

x[t] = μ + u[t] + e[t].

The third type (type3) is the one with both drift and trend:

x[t] = μ + α*t + u[t] + e[t].

The details of calculation of test statistic (kpss) can be seen in the references below. The default parameter of lag to calculate the test statistic is max(1,floor(3*sqrt(n)/13) for short term effect, otherwise, max(1,floor(10*sqrt(n)/13) for long term effect. The p.value is calculated by the interpolation of test statistic from tables of critical values (Table 5, Hobijn B., Franses PH. and Ooms M (2004)) for a given sample size n = length(x).

Value

A matrix for test results with three columns (lag, kpss, p.value) and three rows (type1, type2, type3). Each row is the test results (including lag parameter, test statistic and p.value) for each type of linear regression models.

Note

Missing values are removed.

Author(s)

Debin Qiu

References

Hobijn B, Franses PH and Ooms M (2004). Generalization of the KPSS-test for stationarity. Statistica Neerlandica, vol. 58, p. 482-502.

Kwiatkowski, D.; Phillips, P. C. B.; Schmidt, P.; Shin, Y. (1992). Testing the null hypothesis of stationarity against the alternative of a unit root. Journal of Econometrics, 54 (1-3): 159-178.

See Also

adf.test, pp.test, stationary.test

Examples

1
2
3
4
5
6
# KPSS test for AR(1) process
x <- arima.sim(list(order = c(1,0,0),ar = 0.2),n = 100)
kpss.test(x)

# KPSS test for co2 data
kpss.test(co2)

Example output

Attaching package: 'aTSA'

The following object is masked from 'package:graphics':

    identify

KPSS Unit Root Test 
alternative: nonstationary 
 
Type 1: no drift no trend 
 lag  stat p.value
   2 0.431     0.1
----- 
 Type 2: with drift no trend 
 lag  stat p.value
   2 0.115     0.1
----- 
 Type 1: with drift and trend 
 lag  stat p.value
   2 0.113     0.1
----------- 
Note: p.value = 0.01 means p.value <= 0.01 
    : p.value = 0.10 means p.value >= 0.10 
KPSS Unit Root Test 
alternative: nonstationary 
 
Type 1: no drift no trend 
 lag    stat p.value
   4 0.00733     0.1
----- 
 Type 2: with drift no trend 
 lag   stat p.value
   4 0.0422     0.1
----- 
 Type 1: with drift and trend 
 lag   stat p.value
   4 0.0939     0.1
----------- 
Note: p.value = 0.01 means p.value <= 0.01 
    : p.value = 0.10 means p.value >= 0.10 

aTSA documentation built on May 1, 2019, 8:47 p.m.