11
$\begingroup$

To check whether the data is stationary or not, I computed KPSS and ADF test and got the following results

adf.test(td,alternative = "stationary")

    Augmented Dickey-Fuller Test

data:  td
Dickey-Fuller = -3.7212, Lag order = 3, p-value = 0.03058
alternative hypothesis: stationary

Here, the p-value is <0.05, which suggests that the data is stationary.

kpss.test(td, null="Level")
Warning message:
In kpss.test(td, null = "Level") : p-value smaller than printed p-value
KPSS Test for Level Stationarity

data:  td
KPSS Level = 1.7174, Truncation lag parameter = 1, p-value = 0.01

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


    KPSS Test for Trend Stationarity

data:  td
KPSS Trend = 0.17075, Truncation lag parameter = 1, p-value = 0.02938

Here, the data seems to be accept level stationarity and trend stationarity as the p-values are less than 0.05. Since the results of ADF and KPSS contradict, I am confused whether the data is stationary or not. Please let me know if my understanding is wrong somewhere or if I need to perform some more test in this case.

$\endgroup$

4 Answers 4

12
$\begingroup$

Please have a look at my answer to the following question. What is the difference between a stationary test and a unit root test? Here is the most important part of the answer:

If you have a time series data set how it usually appears in econometric time series I propose you should apply both a Unit root test: (Augmented) Dickey Fuller or Phillips-Perron depending on the structure of the underlying data and a KPSS test.

Case 1: Unit root test: you can’t reject $H_0$; KPSS test: reject $H_0$. Both imply that series has unit root.

Case 2: Unit root test: Reject $H_0$. KPSS test: don`t reject $H_0$. Both imply that series is stationary.

Case 3 If we can’t reject both test: data give not enough observations.

Case 4 Reject unit root, reject stationarity: both hypothesis are component hypothesis – heteroskedasticity in series may make a big difference; if there is structural break it will affect inference.


Edit: In case 4 a more profound approach would be to apply a variance ratio test. The variance ratio test renders you a value between 0 and 1 if the data is "between stationarity and a unit root". As the variance ratio test does not only affirm or reject a null hypothesis, but gives you a continuous value it can capture mixtures in more detail. It may also give you insight to visualise the data.

$\endgroup$
4
  • $\begingroup$ @fredi : Interestingly the results of PP test and Acf itself contradicts. PP.test has p value less than 0.01 where ACF test has p-value 0.3 $\endgroup$
    – Praveen
    Oct 10, 2016 at 7:59
  • $\begingroup$ Phillips, P. C. B.; Perron, P. (1988). "Testing for a Unit Root in Time Series Regression". Biometrika. 75 (2): 335–346. doi:10.1093/biomet/75.2.335. report that the Phillips–Perron test performs worse in finite samples than the augmented Dickey–Fuller test. Do you have a small sample? $\endgroup$
    – Ferdi
    Oct 10, 2016 at 10:03
  • 2
    $\begingroup$ Also note that a series can be I(0) (absence of unit root) and nonstationary at the same time. That is because there are many forms of nonstationarity, and unit root is just one of them. Probably you are trying to say so in Case 4, but I am not sure. $\endgroup$ Oct 11, 2016 at 18:46
  • $\begingroup$ Related: ideas.repec.org/a/eee/ecolet/v61y1998i1p17-21.html $\endgroup$ May 2, 2019 at 7:55
0
$\begingroup$

"Here, the data seems to be accept level stationarity and trend stationarity as the p-values are less than 0.05."
The H0 for KPSS is that the data is stationary. So shouldn't we reject the H0 (p-values <0.05) and infer non-stationary?

$\endgroup$
0
$\begingroup$

You are not comparing test statistic (ADF statistic and KPSS statistic) against the critical value and are just looking at p-value. If you check, it is still possible that they give contradictory results. But the result will be ADF says its stationary while KPSS says it is non-stationary. This means that unit root does not exist and the stationarity is trend stationarity.

$\endgroup$
1
  • $\begingroup$ I thought KPSS can handle trend stationarity. Can you elaborate a bit on this? $\endgroup$
    – BCR
    May 7, 2020 at 16:58
0
$\begingroup$

It would have been good to have a reproducible example to test and understand better.

That said, I'm speaking from the deepness of my ignorance as I'm learning these days, and had exactly the same problem of yours.

I ended up finding that in my time series I was having multiple rows with the same timestamp (e.g. [[2020-05-22, 20], [2020-05-21, 10], [2020-05-12, 5],[2020-05-22, 20], [2020-05-21, 10], [2020-05-12, 5]]). This was due to the presence of another feature to make those entries necessary for other calculation.

But it turned out that having those duplicates were creating issues, which I solved by summing up the values before getting the new dataframe digested by both KPSS and ADF. At that point, both of them revealed the non stationarity. Perhaps the OP case is the same.

Kudos to the other answer from where I guess I learnt something too.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.