6
$\begingroup$

I have a quarterly time series and test for stationarity with an augmented Dickey-Fuller test using R.

adf.test(myseries)
# returns
# Dickey-Fuller = -3.9828, Lag order = 4, p-value = 0.01272
# alternative hypothesis: stationary 

so the H0 is rejected. I tried to validate this intuitively and regressed the same series on a linear trend.

x<- 104:1
fit.1<-lm(myseries~x)
summary(fit.1)
#returns
# x      0.024  1.31e-05 ***

Even though a simple linear model is not so appropriate here and the intercept is large (around 80), there seems to be a slight downwards trend over time, which is in line with my thoughts after looking at the initial data. So do I get the adf.test wrong or is the trend just to small to be discovered?

Besides I used

plot(stl(myseries,"per"))

and ended up with a graph which sidebars suggested that trend and remainder were the main components driving the data, while seasonal influence was negligible. I saw that stl() uses Local Polynomial Regression Filtering and got a rough idea how that works (still I wonder why smoothed trends of Hadley's ggplot2 package looked that different even though it uses the same method by default).

So summing up I got: - adf finding no evidence for a trend - a slight downwards trends "detected" by eyeballing and the naive approach - loess decomposition stating that the trend has strong influence (by the relation of its bars in the plot)

So what can I learned from this? Probably I do have a terminology problem here, because the former two seem to address time trends while the latter address some other trend I cannot fully grasp yet. Maybe my question is just: Can you help me to understand the trend extracted by loess? And how is it related to smoothed / filtered stuff like HP-Filter or Kalman Smoothing (if there is a relationship and similarity does not only occur in my case)?

$\endgroup$
  • 1
    $\begingroup$ it would be easier to judge if you insert a plot of your data. For adf-test you have an option to test the trend stationarity, also consider alternative tests KPSS, PP. It may happen that you have some deterministic parts. You may use HP and more general Kalman Smoothing for trend extraction, loess do the same locally, so it bares in mind only a window of data, by default, I think, it fits linear trend. So loess for seasonal smoothing HP, Kalman not for seasonal but cyclical smoothing. Baxter-King though could do both. Looking for the data screening though to add more. $\endgroup$ – Dmitrij Celov Mar 16 '11 at 10:15
  • $\begingroup$ what is y in your second code snippet? $\endgroup$ – mpiktas Mar 16 '11 at 14:13
  • $\begingroup$ @mpiktas: sorry, y should by x, it's the linear decreasing trend. Just changed because I thought an explanatory called y would be misleading and forgot it up there. now it's fine. $\endgroup$ – hans0l0 Mar 16 '11 at 15:14
7
$\begingroup$

The answer to your first question is no. If the null hypothesis of unit root is rejected, the alternative in its most general form is stationary series with time trend. Here is the example:

> rr <- 1+0.01*(1:100)+rnorm(100)
> plot(rr)
> adf.test(rr)

    Augmented Dickey-Fuller Test

data:  rr 
Dickey-Fuller = -4.1521, Lag order = 4, p-value = 0.01
alternative hypothesis: stationary 

Message d'avis :
In adf.test(rr) : p-value smaller than printed p-value

So your findings are consistent with ADF test: there is no unit root, but there is a time trend.

$\endgroup$
  • $\begingroup$ thanks for the nice example. Probably I still got a problem with the terminology. I see that the H0 of unit root is rejected – so what does stationary mean if there can be a time trend like you have shown? $\endgroup$ – hans0l0 Mar 16 '11 at 15:10
  • 2
    $\begingroup$ @ran2, adf test is designed to test whether the stochastic trend is present. Although series with deterministic trend are non-stationary, regression analysis with them is "safe". Also detrending is meaningful. With stochastic strend the usual detrending methods will give misleading results. $\endgroup$ – mpiktas Mar 16 '11 at 15:29
  • $\begingroup$ hmm what I still don't get: statistics.com defines non-stationarity as "depending on time". and here we seem to have a stationarity variable with a time trend. How can it be stationary if it depends on time? Confuses me... $\endgroup$ – hans0l0 Mar 22 '11 at 12:11
  • 1
    $\begingroup$ @ran2, stationary (weak stationarity) means $EX_t=const$ and $cov(X_t,X_{t+h})=r(h)$, for all $t$ and $h$. If these properties are violated then the process is not stationary. However if the process is $Y_t=f(t)+X_t$, where $X_t$ is stationary and $f$ is some function, it is called trend-stationary. The analysis of trend-stationary and stationary processes is similar, so that is why sometimes trend-stationary processes are called stationary, although strictly this is not the case. $\endgroup$ – mpiktas Mar 23 '11 at 7:15
  • $\begingroup$ many thx for the elaborate help with the terminology. I guess I got it now :) $\endgroup$ – hans0l0 Mar 23 '11 at 8:39
5
$\begingroup$

Larry Bretthorst's extended phd will greatly help you I think. You should take the discrete fourier transform of the data. This will give you a look at your series in the frequency domain. Trend is represented by low frequency. Ultimate modeling book. It's 200 pages, but well worth it - includes computer code to implement the methods

$\endgroup$
  • $\begingroup$ Are you sure he has enough data points to produce meaningful spectral analysis? Though I also do like to work in the frequency domain from time to time :) (+1) for the link though, will add to my collection of 'yet to read' things. $\endgroup$ – Dmitrij Celov Mar 16 '11 at 13:33
  • $\begingroup$ Thanks for the link, indeed it's some work to go through that, but I'll try to go through it as far as I can. Though if already a question concerning the direction of this read... Is it entirely focused on estimating frequency? $\endgroup$ – hans0l0 Mar 18 '11 at 9:50
  • $\begingroup$ That is the example used, but if you look at the functional form of the model, it is an extremely general model (incorporates all regression models, OLS and GLMs, trend and seasonal analysis, etc.). Although you would need to fill in the specific details. It does go through an example of removing trend on page 146. $\endgroup$ – probabilityislogic Mar 18 '11 at 11:03
1
$\begingroup$

The ADF test has weak power and, as Dmitrij Celov mentioned, you should probably also check the results of PP and KPSS tests. If you find that your results are on the margin of detecting a unit root, it's possible your series is fractionally integrated. I would also check ACF and PACF plots of the series, looking for slow decay patterns. Generally, if you find that ADF test and Phillips-Perron reject the null of a unit root, but that the KPSS and ACF/PACF plots demonstrate some statistically-significant persistence through several lags, this may be strong evidence for fractional integration.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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