# When is first differences for time series trend removal appropriate to use?

I was just wondering when it is appropriate to use particular time series trend removal methods, specifically first differences and link relatives methods. I have two time series as given here:

I then took the cumulative sum of each series, which now yields two new time series as follows:  It is clear that these two time series look very similar, so I now wish to find just how closely related they are - as such, I would like to try and find the correlation between the two of them. Now, according to Avoiding Common Mistakes with Time Series I should try and remove the trend first before finding correlation. The two (nonparametric) methods that the link above suggests are first differences method and link relatives method. Now, since the two plots appear to be autocorrelated, first differences does not appear suitable (at least I do not think it is, I'd like to include the images but I'm restricted to only two unfortunately). Does this mean that I should instead change to link relatives method? Or alternatively, should I instead use the original time series rather than the cumulative sum time series and then try using first differences?

• If you are dealing with cumulative sums, you will have stochastic trends (random walk). The idea of differencing is the most natural when working with cumulative sums; logically thinking, cumulative sums should have been the original motivation for differencing. – Richard Hardy May 14 '17 at 9:04
• Ah ok, I didn't know that first differencing method was best with cumulative sum time series so I'm glad to hear that! Sorry if it's a dumb question, but how do you know that only stochastic trends/random walk will be left over by taking cumulative sums of a time series? Also, given what you mentioned above, do you believe it would be best for me to continue working with the cumulative sum of the time series rather than the original version of the data? I only ask because I thought that taking first differences of the cumulative sum time series is a bad idea due to possible autocorrellation – ThePlowKing May 14 '17 at 10:38
• If you cumulatively sum up an i.i.d. sequence, you will get a pure random walk. If you sum up an ARMA(p,q) sequence, you will get an I(1) process of the shape ARIMA(p,1,q). It is sometimes easier to work with un-transformed data if you know what transformation was used to begin with, so that you can undo it. But sometimes data transformations make the job easier (e.g. a log transformation is popular in macroeconomics). – Richard Hardy May 14 '17 at 12:18
• This is probably yet another dumb question, but how were you able to assume that the original time series were an i.i.d. sequence? Is it a common/normal assumption to make when working with time series in general? (I'm now able to attach the pics of the original time series in the original post if that helps) – ThePlowKing May 14 '17 at 12:52
• No, I am not assuming that for any particular application. I used it as a theoretical argument. But stock prices could probably be assumed to be a cumulative sum of roughly i.i.d. random variables (except for conditional heteroskedasticity). – Richard Hardy May 14 '17 at 12:55

When is first differences for time series trend removal appropriate to use?

If you are dealing with cumulative sums of stationary series, differencing is a natural transformation to perform. Cumulative sums are nonstationary, have infinite variance and thus generally misbehave when used in linear regression, correlation analysis and similar.

One exception where differencing removes valuable information is in the context of cointegrated time series. That is, when a few integrated series share a common stochastic trend (or a few), this commonality will be removed by simply differencing each of the series, and linear models built by ignoring cointegration will suffer from omitted variable bias due to the omitted error correction term.

Meanwhile, taking the first difference of a stationary series (or a stationary series plus a deterministic time trend) is a rather redundant transformation. It introduces an integrated moving average component in the resulting transformed series which increases the variance in linear models as compared with linear models for the original series in their levels (adjusted for a deterministic time trend, if any).

would it be equally appropriate for me to take first differences on the original time series (as given above)?

The paragraph above should answer this.

Now, since the two plots appear to be autocorrelated, first differences does not appear suitable (at least I do not think it is <...>).

Autocorrelation and first differencing are tangential, except under the presence of a unit root when autocorrelation is extremely high and differencing is a natural transformation. But in general, you may have something like an ARIMA(p,1,q) model which would require differencing but still exhibit autocorrelation due to the AR and MA terms.

Edit (responding to a comment)

but what if I don't know if my original time series are stationary?

You can test for various forms of nonstationarity. E.g. you can test for a unit root (which is one form of nonstationarity) by the augmented Dickey-Fuller test. You can also test for structural change etc. Also, sometimes you will notice visually that the series behaves differently in different periods, which is an informal indication of nonstationarity.

is there an easy way to check if two time series are cointegrated? The tests I've seen so far seem to require checking for statistical significance etc. so I was hoping for a slightly easier and more efficient way.

Perhaps the best you can do without formal testing is running a regression of one series on the other one (or other ones) and visually inspecting the residual. If the residual looks stationary, the series are cointegrated. But also formal testing is not that difficult now that there are functions in statistical packages that do that.

• Wow, that helps quite a bit! Although I do have two more further questions: firstly you mention that differencing is a natural transformation to perform for cumulative sums of stationary series, but what if I don't know if my original time series are stationary? And secondly, is there an easy way to check if two time series are cointegrated? The tests I've seen so far seem to require checking for statistical significance etc. so I was hoping for a slightly easier and more efficient way. Thanks heaps! – ThePlowKing May 14 '17 at 21:20
• @ThePlowKing, edited the answer to include what you asked for. – Richard Hardy May 15 '17 at 6:21
• Perfect, thanks so much for all the help, you honestly don't know how much I appreciate it! – ThePlowKing May 15 '17 at 6:56
• @ThePlowKing, I am very pleased to have been able to help. But statistics is tricky, so keep you eyes open for alternative arguments as well and see which make more sense to you. – Richard Hardy May 15 '17 at 7:30
• Oh definitely, everything you've said in all your posts though appears to match up with the methods I've been checking through in various books, so I'm quite happy to follow and agree with what you've written :) – ThePlowKing May 15 '17 at 11:07

One way I have checked for cointegration is to run the OLS model on 2 series and then just do the ADF test on the OLS.residuals. If the residuals are stationary, then the series are considered cointegrated.