◢◤ ARKANE_
SYS_TIME UTC+0
Work with me

Chapter 20 quiz · 24 questions

Time Series Analysis

Tests leakage-free splits and lag features, stationarity and differencing, ACF/PACF order selection, ARIMA, exponential smoothing by hand, and forecast baselines and error metrics.

Based on chapter 20. Every answer comes with an explanation and a link back to the section.

/Q20

Quiz

Question 1 of 24

Leakage-free splits, TimeSeriesSplit and lag features Level 1
Progress

Why does a random 80/20 train/test split give misleading results on a daily sales series?

Choose one
/02

练习From the book

7 exercises

The chapter's own exercises are open questions. Try one, then compare with the model answer.

Exercise 20.1 [W]

Explain in your own words why a random 80/20 train/test split is invalid for time series data but fine for the datasets used in earlier chapters.

Show the model answer

Earlier chapters' datasets were assumed independent and identically distributed. Each row's order carries no information, so shuffling before splitting doesn't change what the model can learn. Time series data has the opposite property by definition: today's value depends on yesterday's. A random split lets some training rows sit chronologically after some test rows, letting the model implicitly "see" future information relative to what it's being scored on.

Exercise 20.2 [W]

State what a slowly-decaying ACF (no sharp cutoff at any lag) tells you about a series, and what action it suggests.

Show the model answer

A slowly-decaying ACF (no sharp cutoff) is the signature of non-stationarity: the series' statistical properties are drifting over time rather than settling into a stable pattern. The action it suggests is differencing the series (and re-running the ADF test) before attempting to fit ACF/PACF-based model orders or an ARIMA model at all.

Exercise 20.3 [A]

Using this chapter's measured ADF p-values (0.682 raw, roughly 3×10−273 \times 10^{-27} differenced), explain what "reject the null hypothesis" means concretely for the differenced series, using the 0.05 significance threshold.

Show the model answer

Rejecting the null hypothesis at p≈3×10−27<0.05p \approx 3 \times 10^{-27} < 0.05 means there's overwhelming statistical evidence against "this series has a unit root," i.e. is non-stationary. The differenced series can be treated as stationary, satisfying the assumption ARIMA-family models need. The raw series' p=0.682p=0.682, far above 0.05, means the null hypothesis of non-stationarity cannot be rejected. That's consistent with the visible upward trend that was deliberately built into the synthetic data.

Exercise 20.4 [A]

Using Listing 20.5's measured results (ARIMA MAE 7.228, naive MAE 4.602), compute the percentage by which the naive baseline outperforms ARIMA, and propose one change to the forecast horizon (longer or shorter) that this chapter's explanation would predict might reverse that result.

Show the model answer

Naive MAE (4.602) is lower than ARIMA MAE (7.228) by (7.228−4.602)/7.228≈36.3%(7.228-4.602)/7.228 \approx 36.3\%: naive outperforms ARIMA by roughly 36% on this metric. A longer horizon (say, 180 or 365 days) would more plausibly reverse this result. "Repeat the last value" becomes a progressively worse assumption the further out the trend and seasonal cycle are expected to move. ARIMA's explicit trend/autoregressive structure has more room to demonstrate a genuine advantage once the naive baseline's flat-line assumption clearly breaks down.

Exercise 20.5 [E]

A team reports "our ARIMA model achieves MAE of 7.2 on 28-day demand forecasts" as evidence it's ready to ship. Using this chapter's Worked Example, write the question you'd ask before agreeing.

Show the model answer

"Did you compare that 7.2 MAE against a naive baseline, just repeating the last observed value for all 28 days? This chapter's own measurement found exactly that comparison flipping the expected result: a naive baseline beat a reasonably-specified ARIMA model at this horizon. An MAE number in isolation, without the baseline comparison, doesn't tell you whether the model is adding value."

Exercise 20.6 [E]

A colleague computes a 7-day rolling mean feature for a lag-feature forecasting model using .rolling(7).mean() without first calling .shift(1). Using Procedure 20.1's common mistake about leakage, explain what's wrong.

Show the model answer

Computing .rolling(7).mean() without .shift(1) first means the rolling window for row tt includes row tt's own value. The feature meant to summarise "the past 7 days" includes today's target value baked into its own input. That's a direct form of leakage: the model gets to see (an average containing) the answer as part of its own input feature.

Exercise 20.7 [R]

Read the Hyndman and Athanasopoulos chapter on forecast evaluation (fpp3, "Evaluating forecast accuracy"). Identify one accuracy measure they discuss that this chapter's reference material does not (beyond MAE, RMSE, MAPE, sMAPE), and explain what situation it's designed for.

Show the model answer

Discussion only. Hyndman and Athanasopoulos discuss measures like MASE (Mean Absolute Scaled Error), which scales errors relative to a naive/seasonal-naive baseline's own error rather than relative to the raw target values. It's designed specifically to allow comparison across series of very different scales, and to remain well-behaved when the series can be at or near zero, exactly the situation this chapter flags as breaking MAPE.

online /books/classical-data-science/quiz/20 Newcastle, UK v0.1.0 // rss