Time Series 101: What Are We Even Predicting?
Time Series 101: What Are We Even Predicting?
Imagine you're running a small coffee shop. Every morning, you glance at yesterday's sales, the weather, the day of the week, and your gut feeling — then you decide how many beans to grind, how many pastries to bake, how many staff to call in. Now multiply that decision by a thousand: a retail chain forecasting demand for 50,000 SKUs across 2,000 stores, a hospital projecting ICU admissions for the next fourteen days, a grid operator balancing electricity supply when solar output swings with cloud cover, an airline pricing seats for a flight that won't take off for another nine months. All of them are doing the same thing you're doing with your beans — they're staring at a sequence of numbers that arrived in time order and trying to guess what comes next.
That sequence is what we call a time series. And while the concept feels obvious (it's just data over time, right?), the moment you try to model it with the same tools you'd use for, say, predicting house prices from square footage, you'll find yourself in a world of hurt. Time series data has a stubborn personality: it carries memory, it has rhythm, it refuses to be reshuffled, and it punishes anyone who treats it like a regular spreadsheet.
This chapter is the foundation everything else stands on. We're going to answer the question lurking behind every forecasting project: what are we even predicting? Along the way, you'll learn the vocabulary that forecasters use (trend, seasonality, cyclicity, noise, stationarity — the whole gang), why simple methods fail in surprisingly subtle ways, and what "good" forecasting actually means when the future is fundamentally uncertain. We'll also set up your Python environment and do your first real decomposition on a classic dataset — the monthly airline passenger numbers from 1949 to 1960. By the end, you'll have a working mental model for the rest of the book, plus a hands-on win you can show off.
What Makes Time Series Data Different?
Here's the uncomfortable truth that statisticians have been arguing about since the 1920s: time series data isn't just "data with a time column." That framing sounds reasonable until you realize what it implies. If time were just another feature — like "number of bedrooms" or "zip code" — then the order of rows shouldn't matter, you should be able to shuffle them freely, and standard regression should work fine. But it doesn't. And the reason it doesn't is the single most important idea in this chapter.
Time series data has a temporal dependency structure that ordinary tabular data lacks. Each observation depends on what came before it. Today's stock price is shaped by yesterday's. This morning's electricity demand is shaped by yesterday morning's, and by the temperature at this hour last week, and by whether the day before that was a holiday. When you randomize rows, you destroy that structure. When you fit a regression that assumes independent observations, you get standard errors that are wildly wrong, predictions that look great in-sample and fall apart out-of-sample, and confidence intervals that lie to your face.
Let me make this concrete with three differences that bite people in practice.
1. Order Matters
Consider two tables. Table A has 100 rows, each with columns `[date, sales]`, sorted from oldest to newest. Table B has the same 100 rows, but with the dates shuffled into a random order. In a normal dataset, both tables would be equivalent — the model would learn the same relationship between features and targets. For time series, Table A is a forecasting problem. Table B is meaningless noise. The information lives in the sequence, not the set.
This is why you should never use random train/test splits for time series. Always use a temporal split: train on the past, validate on the future. If you randomize, your model can "cheat" by peeking at tomorrow's patterns to predict today, which inflates accuracy metrics and destroys any hope of honest evaluation. This single rule — *respect the arrow of time* — separates serious forecasters from people who are about to publish a model that works great in notebooks and falls apart in production.
2. Observations Are Not Independent
The second difference is statistical: time series observations are correlated with each other. This is called autocorrelation, and it's measured by something called the autocorrelation function (ACF), which we'll explore in depth in Chapter 2. In a normal regression, we assume residuals are independent — knowing one residual tells you nothing about the next. In time series, today's residual often tells you a lot about tomorrow's. If today's temperature was higher than the model predicted, there's a decent chance tomorrow's will be too, because weather systems persist.
Why does this matter operationally? Because almost every statistical test, every confidence interval, and every p-value in classical regression depends on that independence assumption. When it's violated, your significance tests become unreliable. A variable that looks "highly significant" might just be riding a wave of autocorrelation. This is why time series analysis has its own dedicated toolkit — Box-Jenkins methodology, ARIMA models, state space models, GARCH for volatility — that explicitly handles these dependencies rather than ignoring them. The math is more intricate, but it's necessary to get the answers right.
3. The Future Isn't a Frozen Distribution
In a typical machine learning task, you might assume that the data you're training on comes from the same distribution that you'll see at deployment. This is the "i.i.d." assumption: independent and identically distributed. Time series violates this all the time, in two ways. First, trends shift the distribution over time (your user base grows, your product becomes more popular, climate change raises baseline temperatures, an aging population increases healthcare demand). Second, structural breaks can happen suddenly (a pandemic, a regulatory change, a new competitor entering the market, a war disrupting supply chains). The 2020 COVID shock is the canonical example: every forecast that had been working for years went haywire, and models that handled distribution shift gracefully proved far more valuable than models that were narrowly accurate on historical data.
These three differences — order, dependence, and distributional drift — are why forecasting is its own discipline. They're also why, when you ask "why can't I just throw this into XGBoost?" the answer is "you can, but you'll be ignoring the very thing that makes time series interesting." Modern approaches like Temporal Fusion Transformers and N-BEATS explicitly bake temporal structure into their architectures. Older approaches like ARIMA build it into the math from the ground up. The thread that runs through the entire field is: respect the time.
A Quick Contrast
Let me put this in a table you can mentally bookmark:
| Aspect | Tabular ML | Time Series | |--------|------------|-------------| | Row order | Irrelevant | Critical | | Observation independence | Assumed | Usually violated | | Train/test split | Random is fine | Must be temporal | | Primary goal | Often classification or regression | Almost always future prediction | | Distribution over time | Assumed stationary | Can drift, break, evolve | | Evaluation metric | Often accuracy, AUC | Almost always forecast error at horizon |
If your problem looks like the right column, you're in the right book.
The Four Faces of Time Series: Trend, Seasonality, Cycles, and Noise
Once you accept that time series is its own beast, the next question is: what's actually inside the data? A useful decomposition, popularized by statisticians like Hyndman and Athanasopoulos in their classic textbook *Forecasting: Principles and Practice*, breaks almost any time series into four components. Understanding them is the difference be