# Does it make sense to classify time series with OLS?

I have a bunch of time series (~2000) with monthly data stretching over one hundred years. My interest is not to do inference on them but simply to classify them as descending or not. There are two important features of my data: (1) a lot of data points are missing (~50%), and (2) there is a very strong seasonality to the data (~10x larger than the trend).

My first thought was to simply do a OLS regression on each one and if the second coefficient is negative I would classify the series as descending. But then I started thinking: Should I somehow remove the seasonality before the OLS or account for it in the OLS via dummy variables for months, or can I just trust in OLS to do a decent job anyway?

If you have 2000 time series I would recommend an automatic forecasting package, such the R Forecast package.

You can use the na.interp() function to fill in missing values. The forecasting routines (e.g. auto.arima()) can detect and estimate seasonal effects.

It seems unlikely that all the series will have linear trends, but you will usually be able to tell whether the trend is upwards or downwards.

run OLS with seasonality dummies, and classify using the slope coefficient while make sure it's significant. OLS will give you all the necessary metrics to do this

You could use moving averages.

Here is the basic idea.

First, consider some time series data with the random variable (RV) on the y-axis and time on the x-axis. We have one RV measurement for each time increment.

We start by taking an average of the RV values for the first n time increments, say n = 5 and taking the average of time increments 1 through 5. We then graph a point representing this average at y = avg. and x = mid-point for the time increments under consideration (x = 3 if the number of time increments is 5).

Now, slide over one time increment, and take the average again for time increments 2 through 6, placing the new average value at x = 4. repeat this until your run out of time increments. Then connect the average points to create a segmented line string representing the trend.

I hope that is clear enough for you to get the picture. This is conceptually very similar to linear regression. However, the representation is a line string, not a line or polynomial.

• Hi @JohnYetter, do you think you could give a little bit more detail in your answer? Right now you are only referring to a YouTube video, which could potentially be removed at some point. Mar 7, 2014 at 5:42
• Sure. I am at work, but I will try to come back and edit my answer to make it more complete. Thanks. Mar 7, 2014 at 13:48