Statistics From Zero · Lesson 31 of 31

Time Series: Trends, Seasons and Fake Correlations

In one sentence: Data collected over time come with trends, seasons and memory, so you compare like with like (this January with last January) and never correlate two trending series without first looking at their changes.

The idea

Most of this course has treated data as a bag of separate observations. A time series is different: the same thing measured again and again over time, such as monthly sales, daily temperatures or a share price. Time series have three habits that break the usual rules:

Aunt Linda's ice-cream kiosk

Aunt Linda runs an ice-cream kiosk by the lake. In January of her third year she sold 50 ice creams, down from 55 in December. Uncle Gary, her self-appointed financial adviser, calls it "a 9% collapse" and suggests closing.

Linda points out that it's January.

Here are her monthly sales in year three, from a simple model of her kiosk: a seasonal pattern plus steady growth of 1% a month.

Com­par­is­onChange
January vs the Decem­ber before9.1% down
Septem­ber vs August26.9% down
January vs January a year earlier11.1% up
July vs July a year earlier10.0% up
Whole year vs the year before10.2% up (1,448 vs 1,314)

Month-to-month comparisons are dominated by the season. Every autumn looks like a crash and every spring like a boom. The fix is to compare like with like: this January with last January (year-on-year), or a full year with a full year. Professional statistics offices publish "seasonally adjusted" figures for the same reason.

Ice creams sold per month, year three

Jan50
Feb56
Mar76
Apr102
May141
Jun194
Jul221
Aug216
Sep158
Oct106
Nov67
Dec61
Model: a seasonal pattern plus growth of 1% a month. The year was 10.2% up on the one before, though autumn looks like a crash.

Memory: autocorrelation

Today's share price is almost exactly yesterday's plus a small change. Correlate a price series with itself shifted by one day and you get about 0.98 in our simulation: an extremely strong link called autocorrelation. Correlate the daily changes instead and you get about 0.00. That's the whole difference between a level, which remembers everything, and the change in it, which may remember nothing.

It matters because most tests assume independent observations. A year of daily prices isn't 250 independent pieces of information. It's closer to one wandering line.

The fake correlation trap

Here's the most expensive mistake in the subject. We generated 2,000 pairs of completely unrelated random walks, 250 steps each (think of two imaginary share prices with nothing to do with each other), and correlated each pair:

What we cor­rel­atedPairs with a cor­rel­a­tion above 0.5 (either sign)
The levels (the "prices")41%
The daily changes0%

Two series that both wander will often wander in the same direction for a while, and their correlation looks strong by pure chance. The typical pair had a correlation of 0.42. This is called a spurious correlation (or spurious regression), and it's why "these two charts move together" proves nothing on its own. Correlate the changes, which removes the shared wandering, and the fake link disappears.

Three habits for any data over time

Try it yourself

A blog shows two lines rising together from 2000 to 2020: the number of streaming subscriptions and the national average house price. The correlation is 0.95. The author suggests streaming makes houses more expensive.

1. Why is 0.95 not impressive here? 2. What would you check instead?

Show the answer

1. Both series have strong upward trends, and almost any two trending series correlate highly. In our simulation even unrelated random walks exceed 0.5 in 41% of cases; two series that both grow steadily will do better still.

2. Correlate the year-to-year changes: did house prices rise faster in the years when subscriptions rose faster? Then ask about common causes, such as rising incomes and low interest rates, which push both up (Lesson 7).

The words your lecturer uses

Lec­turer saysIt means
Time seriesThe same quant­ity meas­ured re­peatedly over time
TrendThe long-run drift up or down
Sea­son­al­ityA pattern that repeats at a fixed in­ter­val
Sea­son­al ad­just­mentRe­mov­ing the typical sea­son­al pattern so months can be com­pared
Auto­cor­rel­a­tionThe cor­rel­a­tion of a series with its own past values
Random walkA series where each value is the last one plus a random step
Sta­tion­aryA series whose average and spread don't drift over time; changes often are, levels often aren't
Spuri­ous cor­rel­a­tion (re­gres­sion)A strong but mean­ing­less link between two trend­ing series
Dif­fer­en­cingWorking with changes from one period to the next instead of levels

Three things to remember

Part 3 so far

Lessons 20 to 31 add tools you'll meet in almost every course and every research report: the binomial and Poisson distributions for counting, ANOVA for comparing more than two groups, effect size for deciding whether a significant result matters, regression to the mean for spotting changes that need no cause, and the difference between watching and experimenting for deciding what causes what. Then the practical kit: histograms for seeing the shape of data, multiple regression for holding other factors fixed, the bootstrap for intervals without formulas, odds ratios for reading health headlines, rank tests for data that won't behave, and time series for anything measured over time.

Part of Statistics From Zero, a free beginner course by WrongStat. Not a substitute for your lecturer, but hopefully a good translator.