Time Series Basics

Difficulty: Intermediate Reading Time: 12 minutes

What Makes Time Series Special

A time series is simply a sequence of data points collected over time: daily stock prices, monthly sales figures, hourly temperature readings, or yearly population counts. What makes time series data different from other types of data is that the order matters. Each observation is connected to the ones before and after it. Tomorrow's temperature is related to today's. This month's revenue is influenced by last month's.

This time-dependence violates a key assumption of most standard statistical methods, which require observations to be independent of each other. You cannot simply apply a t-test or ordinary regression to time series data without accounting for the fact that nearby points are correlated. Time series analysis provides specialized tools designed for exactly this kind of data.

2 4 6 8 10 12 120 140 160 180

The scatter plot above shows monthly sales data for a year. Even in this short series, you can see a general upward movement over time. Identifying these patterns is the first step in time series analysis.

Trends: The Long-Term Direction

A trend is the long-term upward or downward movement in a time series. If a company's revenue has been growing steadily over five years, that growth is the trend. Trends can be linear (a steady increase by a fixed amount each period) or nonlinear (growth that accelerates or decelerates over time).

Identifying the trend helps you understand the big picture and separate the signal from the noise. A single bad month in an otherwise upward trend is very different from a single bad month at the start of a sustained decline. Analysts often "detrend" data by removing the trend component so they can study the remaining patterns, like seasonality and random fluctuations, more clearly.

Seasonality: Repeating Patterns

Seasonality refers to regular, predictable patterns that repeat over a fixed period. Retail sales spike every December. Ice cream sales peak in summer. Gym memberships surge in January. These patterns are driven by calendar effects, weather, holidays, or cultural habits.

5 10 15 20 80 100 120 140 160

The chart above shows two years of data with a clear seasonal hump in the middle of each year, suggesting a summer peak. Notice that the second year's values are slightly higher than the first, indicating an upward trend combined with seasonality. Separating these two components is one of the key tasks in time series analysis, a process called decomposition.

Seasonality is different from a cycle. Seasonal patterns have a fixed, known period (12 months, 7 days, 4 quarters). Cycles are longer-term fluctuations with no fixed period, like business cycles that might last three to ten years. Both are real patterns, but seasonality is more predictable.

Moving Averages: Smoothing the Noise

Raw time series data is often noisy. Day-to-day fluctuations can make it hard to see the underlying pattern. A moving average smooths the data by replacing each point with the average of its surrounding points. A 7-day moving average, for instance, replaces each day's value with the average of the 3 days before it, the day itself, and the 3 days after it.

Moving averages are incredibly popular because they are simple and effective. Financial analysts use them to identify stock price trends. Epidemiologists use 7-day moving averages to smooth daily case counts. Operations teams use them to spot changes in website traffic. The window size (how many points you average) controls how much smoothing you get: a wider window produces a smoother line but reacts more slowly to real changes.

Example

During a pandemic, daily case counts bounce wildly because of reporting delays (fewer cases reported on weekends, a surge on Mondays). A 7-day moving average eliminates this day-of-week effect and reveals the true trend. Public health officials rely on moving averages rather than daily counts to make policy decisions because the smoothed data tells a clearer story.

Autocorrelation: How Today Relates to Yesterday

Autocorrelation measures how strongly a time series is correlated with a lagged version of itself. If today's value is strongly related to yesterday's value, the series has high autocorrelation at lag 1. If this week's sales predict next week's sales, there is autocorrelation at lag 1 in weekly data.

Autocorrelation is important for two reasons. First, it reveals hidden patterns. If a series shows high autocorrelation at lag 12 in monthly data, that strongly suggests a yearly seasonal pattern. Second, it is a critical input for choosing the right forecasting model. Many time series models, like ARIMA, are built directly on the autocorrelation structure of the data.

An autocorrelation plot (also called a correlogram) shows the correlation at each lag. Significant spikes in this plot tell you which past time points contain useful information for predicting the future. If only the first few lags are significant and they decay quickly, the series has short-term memory. If many lags are significant, the series has long-range dependence.

Forecasting: Looking Ahead

The ultimate goal of many time series analyses is forecasting: using historical patterns to predict future values. Simple methods include extrapolating the trend and seasonal pattern forward. More sophisticated methods like exponential smoothing give more weight to recent observations, while ARIMA models use the autocorrelation structure to generate predictions.

All forecasting methods share a core assumption: the patterns observed in the past will continue into the future. This works well for short-term predictions but becomes increasingly unreliable as you look further ahead. No model predicted the 2020 pandemic, and no time series method will anticipate a sudden market shock. Forecasts should always include uncertainty intervals, and the further into the future you predict, the wider those intervals should be.

Key Takeaway

Time series data is unique because the order of observations matters and nearby points are related. The three main components to look for are trend (long-term direction), seasonality (repeating patterns), and noise (random fluctuations). Moving averages smooth the noise to reveal patterns, and autocorrelation reveals how strongly past values predict future values. These fundamentals are the foundation for all time series forecasting.