Making Sense of Time Series Data

A time series is nothing more than data measured over time. For example, you could track the Dow Jones Industrial Average from day to day (or even minute by minute!). In this post, we’ll find out how to analyze the components of time series data.

For a quick overview of the topic, you might want to check out Time Series Analysis and Forecasting Definition and Examples first.

stock market crash

A market crash (or selloff, or correction). Could anyone have predicted it? (Image by Mike Licht)

Components of Time Series Data

Data changes over time. For example, if it’s sunny and 75 degrees outside today, that doesn’t mean that I can expect such nice weather every day. In fact, temperatures might drop to 60 and we could have rain by the end of the month. Six months from now, it could be snowing and a chilly 20 degrees outside!

Time series data may vary due to a number of different reasons.

  • We know that temperatures vary with the seasons, generally warm in the Summer and cold in the Winter. This kind of change in the data is called seasonal variation.
  • Sometimes change takes place over longer time periods. For instance, the US economy seems to go through periods of expansion and recession once every decade or so. This is a cyclical variation.
  • Extremely long-term movement of the data, after all short-term fluctuations are averaged out, is the trend of the time series. Even though the data may show regular ups and downs throughout its lifetime, there could still be an overall upward or downward trend.
  • Finally, the one component of variation that we cannot easily control is the noise. Noise in the data arises from a combination of random fluctuations and any other changes in the trend that cannot be accounted for as cyclical or seasonal oscillations. The level of noise will affect the certainty of future predections: the more noise, the less sure we can be of our forecasts.

Time Series Factors

Each source of variation has its own data series associated to it. Let’s use Yt for the original time series data.

  • Trend factor: Tt
  • Cyclic factor: Ct
  • Seasonal factor: St
  • Noise factor: Nt

(Not all factors may be required for a particular time series.)

Then Yt is the product of the individual factors:

Yt = Tt × Ct × St × Nt

Example time series components

A time series (Yt) is the product of the various movement factors. The numbers are made up to illustrate how the various factors work. The trend (Tt) shows steady upward movement; there is a cyclic movement of period 8 (Ct) and a seasonal component of period 4 (St); finally noise (Nt) causes random fluctuations in the data.

Analyzing Time Series Data

Statisticians have developed sophisticated ways to isolate each of the factors. Although you can always use technology to analyze time series data and create a forecast (predictions into the future), it’s helpful to know a bit about how the process works.

(For a step-by-step introduction into Excel forecasting, check out: Understanding Time Series Forecasting in Excel.)

There are a number of major components to the analysis:

  1. Estimation of the Trend (deseasonalization and regression)
  2. Estimating the Seasonal Variation and Cyclical variation (seasonal index, etc.)
  3. Forecasting

Let’s spend a little time getting to know some of the basic techniques now.

Deseasonalizing the Data

How do you account for seasonal or cyclical variation and isolate the underlying trend? First we have to determine the period(s) of the oscillation(s).

For example, if the time series data represents monthly mean temperatures, then the seasonal period should be 12. We expect February temperatures to be closer to those from last February (12 months previous) than to those from January (one month previous).

There are four main steps:

  1. Compute a series of moving averages using as many terms as are in the period of the oscillation. If the period is odd, then this is a simple average. But if the period is even, then you need a centered moving average.
  2. Divide the original data Yt by the results from step 1.
  3. Compute the average seasonal factors.
  4. Finally, divide Yt by the (adjusted) seasonal factors to obtain deseasonalized data.

Let’s see how it works! Here is some sample data to work with. Below, you’ll find out how to deseasonalize the data.

time series example data

Time series for enrollment in a particular course. The enrollment show obvious oscillations by quarter.

This data is clearly affected by season. Let’s isolate oscillations of period 4.

Moving Averages

The first step is to create a column for moving averages. Note that your moving averages should be placed in the center of the period that you are working with. That means you would not have enough data to begin a moving average computation until halfway through the first period. Also, you can’t compute moving averages that go beyond the last half of the period in the data set.

Now since our period is even (4), we will compute centered moving averages (CMA). Skip the first two rows, and begin on the third row (Summer 2014). Take the CMA using an average of averages:

[ (1201 + 1053 + 830 + 979)/4 + (1053 + 830 + 979 + 1221)/4 ]/2 = 1018.25

(In Excel, you can use the AVERAGE function to save a lot of time!)

Then, in the next column, divide the original data by the CMA. Here’s what it should look like so far:

deseasonalization, step 1

Computing the centered moving averages and extracting the seasonal variability

Seasonal Index

Now you can compute the seasonal index, which is an average of the seasonal factors for each season (e.g. month, quarter, day, etc.).

So in our example, we have Fall seasonal factors of (roughly) 0.815, 0.821, and 0.832. Take the average of these to get the Fall seasonal index for enrollment: 0.823. Do the Same for Winter, Spring, and Summer. The seasonal indexes are highlighted in color below. Copy and paste these indexes throughout the column.

Deseasonalization, step 2

Finally, divide the original data by the seasonal index to get deseasonalized data. This data represents the overall movement of the time series with seasonal effect smoothed out. Typically you would perform a regression on this data to predict the trendline and make forecasts.

Deseasonalization, step 3

Deseasonalized data with trendline shown

Forecasting

The purpose of this article is to explain time series data itself, but a natural next step would be to discuss forecasting. Without getting into the details, you can think of forecasting as continuing the trendline into the future and then factoring back in the seasonal/cyclic components. Along with an estimate of how noise will affect the certainty of our predictions, the forecasting methods provide powerful tools for many applications.

Maybe it’s time to play the stock market and see how good our predictions might be!