# Can I detrend and difference to make a series stationary?

I have a dataset that is clearly increasing as time goes on (exchange rate of a currency, monthly data over 20 years), my question is: Can I detrend the data and then difference it also to make it stationary, if the detrending in itself doesn't achieve this? And if so, would this be considered twice differenced, or just detrended and once differenced?

• I am not an expert on time series, but I believe differencing is a method of detrending. – Peter Flom - Reinstate Monica Nov 24 '12 at 21:55
• @djom: might be easier for people to help with your exact problem if you post a couple of plots of the original and detrended data. You don't have the reputation yet to post images, but just add a link, and we'll include it in the post. – naught101 Nov 25 '12 at 2:54
• I also want to ask on similar lines//..If I make a time series statinary by 1st difference and then take out seasonality with say 12 difference for monthly data ove year..Are we left with only error term on which we calculated the order or AR and MA? – user1921899 Jan 15 '13 at 7:13

If your process is given by $$y_t = \alpha + \beta t + \gamma x_{t} + \epsilon_t$$ then differencing it takes out the constant and the trend so that you're left with $$\Delta y_t = \gamma\Delta x_t + u_t$$ Therefore differencing the series takes out the trend by itself, there's no need to detrend the process beforehand.

EDIT: As noted by @djom and @Placidia in the comments, if the trend is not linear things could get more complicated. To get back to the example above, we would have more precisely

$$\Delta y_t = \beta + \gamma \Delta x_t + \epsilon_t - \epsilon_{t-1}$$

so that the trend is transformed actually to a constant. However if your deterministic trend is some function $f(t)$, then it will depend on behaviour of $f(t) - f(t-1)$. For a polynomial trend with degree $p$, you'll need to difference $p$ times to get rid of it while for exponential trend differencing won't theoretically help at all.

If you observe that differencing twice eliminates the trend, you may be simply facing a quadratic trend, i.e. $\beta_1 t^2 + \beta_2 t$.

• Thanks for the response! I am aware that detrending is a form of differencing but there is obviously a trend in the data from what I can see. So, that's where having to detrend came to mind, but even after doing that the series doesn't become evidently stationary until it is also differenced, hence my thoughts on also differencing. I'm just not sure if thats allowed and as stated in my intial question whether that counts as twice differenced or not. In other words, if I detrend am I still allowed to difference? Or if differencing twice makes it stationary without detrending is that appropriate – djom Nov 24 '12 at 23:10
• Differencing should take out a linear trend. Differencing twice takes out a quadratic trend. If you had to detrend AND difference, presumably the trend has a quadratic component (or is more complex than linear). – Placidia Nov 25 '12 at 4:00
• Here's another great answer closely related to the question. – johnny Nov 25 '12 at 17:48
• Stationary series have the same mean (not necessarily zero) and the same variance over time. If the series is increasing, you may need to control the variance as well (log transform is the first thing to try). – zbicyclist Nov 25 '12 at 19:53

I assume you're referring to nonlinear trend; detrending and differencing in whatever order won't necessarily make a series stationary; it depends on whether the form of nonstationarity is such that it is all captured by integration and trend.