QM002 Hands-on Lab
Change the rolling look-back length
This lab uses the same synthetic series as QM002 — Rolling vs Expanding Windows.
Start here
Run the 60-observation baseline, then try shorter and longer rolling windows.
Python
python labs/python/qm002_hands_on.py
python labs/python/qm002_hands_on.py --window 30
python labs/python/qm002_hands_on.py --window 120R
Rscript labs/r/qm002_hands_on.R 60
Rscript labs/r/qm002_hands_on.R 30
Rscript labs/r/qm002_hands_on.R 120Focus on the trade-off rather than searching for a single preferred number: a shorter window forgets old observations sooner but estimates the model from less data.
What to inspect
- The expanding estimator keeps every historical observation, so pre-break data retain influence indefinitely.
- A shorter rolling window adapts faster after the synthetic break but uses fewer observations for estimation.
- A longer rolling window reduces sampling variation but behaves more like the expanding estimator when old observations remain informative.
Interpretation boundary
The baseline is a controlled synthetic example. It illustrates the adaptation-versus-estimation trade-off; it does not imply that a 30-, 60-, or 120-observation window is generally preferable.