I have a huge dataset consisting of many individuals (~20000), each with a month of daily data.

I am thinking of detrending those individual time series that are non-stationary but visually inspecting each time series for a trend before detrending them is going to be very time-consuming.

My questions are:

  1. Is it appropriate to detrend all the time-series without inspecting them?
  2. And what happens if one detrends a time-series that is already stationary?

1 Answer 1


You are confusing trend with stationarity. You can test for both without needing to visually inspect the plots.

For a trend you can simply build a linear model with time as your variable. If time is significant, that is the slope is increasing / decreasing, then there is a trend in your data.

For stationarity you can use a variety of tests, for ex. Ljung-Box, and there are tests which tell you how many differences you have to take for stationarity.

Also, there is such a thing as over-differencing, so you may want to be careful about needlessly differencing a series.

  • $\begingroup$ if the series is 1,1,1,1,1,5,5,5,5,5 you will get a false conclusion from your linear model with a trend . $\endgroup$
    – IrishStat
    Commented Jul 8, 2019 at 17:38

Your Answer

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

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