## 5.4 KPSS test

The null hypothesis for the KPSS test is that the data are stationary. For this test, we do NOT want to reject the null hypothesis. In other words, we want the p-value to be greater than 0.05 not less than 0.05.

### 5.4.1 Test on simulated data

Let’s try the KPSS test on white noise with a trend. The default is a null hypothesis with no trend. We will change this to null="Trend".

tseries::kpss.test(wnt, null = "Trend")
Warning in tseries::kpss.test(wnt, null = "Trend"): p-value greater than printed
p-value

KPSS Test for Trend Stationarity

data:  wnt
KPSS Trend = 0.045579, Truncation lag parameter = 4, p-value = 0.1

The p-value is greater than 0.05. The null hypothesis of stationarity around a trend is not rejected.

Let’s try the KPSS test on white noise with a trend but let’s use the default of stationary with no trend.

tseries::kpss.test(wnt, null = "Level")
Warning in tseries::kpss.test(wnt, null = "Level"): p-value smaller than printed
p-value

KPSS Test for Level Stationarity

data:  wnt
KPSS Level = 2.1029, Truncation lag parameter = 4, p-value = 0.01

The p-value is less than 0.05. The null hypothesis of stationarity around a level is rejected. This is white noise around a trend so it is definitely a stationary process but has a trend. This illustrates that you need to be thoughtful when applying stationarity tests.

### 5.4.2 Test the anchovy data

Let’s try the anchovy data.

kpss.test(anchovyts, null = "Trend")

KPSS Test for Trend Stationarity

data:  anchovyts
KPSS Trend = 0.14779, Truncation lag parameter = 2, p-value = 0.04851

The null is rejected (p-value less than 0.05). Again stationarity is not supported.