2

I have some difficulties while trying to understand if my data has stochastic or deterministic trend. As I understand in R I need to use adf.test, but how should I interpretate the results?

If adf.test accepts null hypothesis so that means that there's unit root. Later I use function diff() and check adf.test results again. If after making differences adf.test rejects null hypothesis Does it mean that my data has stochastic trend?

Any help would be very useful, thank you!

Engi
  • 33
  • 3

1 Answers1

1

Augmented Dickey Fuller Test (ADF) is used to check if a process is stationary or not. The Null Hypothesis is that the process is stationary so it has no trend. The Alternative Hypothesis is that the process is not stationary, so it may follow a deterministic or stochastic trend. e.g. it's an upward slope

In R the command is the following:

adf.test(data$variable)

So if you find that the p-value is lower than a given threshold, usually 0.05, then you reject the null of stationarity. If it is larger than 0.05 the series is stationary.

In case your series is not stationary you may want to "stationarize" it. The usual way to proceed is by differentiating the log of the series. In R it would look like:

diff1 <- diff(log(data$variable))

Then you perform another ADF test, if you reject the null of stationarity again then you'll have to differenciate again:

diff2 <- diff(diff1)

Time series usually are stationary when doing the first difference, very rarely you need to differenciate more than once.

Hope it helps

adrian1121
  • 904
  • 2
  • 9
  • 21
  • Thank you for the answer! but are you sure about null hypothesis? I think null hypothesis of adf.test is that process has unit root and alternative hypothesis says that process is stacionary... am I wrong? – Engi May 05 '16 at 04:30
  • @Engi Sorry for being imprecise. The fact is that you can set the alternative hypothesis to whatever you want (I always use, alternative = "explosive", for that reason I got confused). The command is the same but: adf.test(data$variable, alternative = "explosive"). – adrian1121 May 05 '16 at 08:38