Random Walks Slides Random Walks
Intro to Time Series Analysis
STATISTICS & PROBABILITY
The Fourth Dimension
Defining Time Series
A Time Series is a sequence of data points indexed in time order.
Points are NOT independent.
Order matters: \( \{x_1, x_2, ..., x_t\} \)
Often collected at regular intervals.
Examples
Daily Stock Price
Annual Global Temp
Heart Rate (BPM)
The Drunkard's Path
Concept: Random Walk
Imagine a process where each step is a random movement, independent of the previous steps, but the current position is the sum of all previous steps.
\[ Y_t = Y_{t-1} + \epsilon_t \]
Components
\( Y_t \): The current value.
\( Y_{t-1} \): The previous value.
\( \epsilon_t \): Random error (step) at time \( t \).
Key Insight
The "future" is just the "present" plus a random shock. There is no long-term memory of a mean!
Coin Flip Random Walk
🪙
Heads
+1 Step
🪙
Tails
-1 Step
T=0 Time \(\rightarrow\) T=10
Does it look like a pattern... or just luck?
Drunkard's Path Lab Worksheet Drunkard's Path Lab
Stochastic Simulation: Random Walks
Name:
Date:
Laboratory Objective
Manually simulate a one-dimensional random walk to observe how simple random shocks accumulate into complex temporal structures.
1 Step Generator
Flip a coin 20 times. Heads = +1 , Tails = -1 . Calculate the cumulative sum (Position).
Time (\(t\)) 0 1 2 3 4 5 6 7 8 9 10 Flip (H/T) — Position (\(Y_t\)) 0
Time (\(t\)) 11 12 13 14 15 16 17 18 19 20 Flip (H/T) Position (\(Y_t\))
2 Plotting the Path
Plot your Position (\(Y_t\)) vs. Time (\(t\)) . Connect the dots with a line.
POSITION (Y)
TIME (T)
3 Lab Analysis
1. Looking at your graph, does the data appear to have a "trend"? If you didn't know it was random, how would you describe the movement?
2. At time \(t=20\), what is the probability that your next position (\(t=21\)) will be higher than your current position?
3. Why do we call this a "stochastic process" rather than just a "list of random numbers"? (Hint: Think about dependency).
Time Series Teacher Guide Teacher Guide Lesson 1 / 5
Random Walks & Time Series
Pacing Guide
Hook / Intro 10 min
Lecture: Definitions 15 min
Drunkard's Path Lab 25 min
Debrief / Exit Ticket 10 min
Key Vocabulary
Stochastic Process
A sequence of random variables representing the evolution of a system over time.
Stationarity
A process whose statistical properties (mean, variance) do not change over time. (Intro only).
Accumulation
How current state depends on past shocks.
The Hook: Stock or Coin?
Show students two graphs: one is a 3-month chart of a volatile stock (like NVDA or TSLA) and the other is a simulated coin-flip random walk (similar to the lab activity).
"Ask students: Which one of these is 'real' data and which is pure luck? Most will find patterns in the luck-based graph (head-and-shoulders, support lines). This demonstrates the Illusory Correlation inherent in human pattern recognition."
Instructional Deep Dive
Random Walk Equation
Emphasize that \( Y_t = Y_{t-1} + \epsilon_t \) means the process has perfect memory . Every single past shock (\(\epsilon\)) is still contained within the current value.
\( Y_t = \sum_{i=1}^t \epsilon_i \)
Common Pitfalls
Students confusing "Independence of Steps" with "Independence of Values".
Thinking the Random Walk will always return to zero (The Gambler's Fallacy).
Assuming "stochastic" just means "messy".
Facilitation Tips
During the "Drunkard's Path Lab," circulate and look for students who are "smoothing" their graphs. Remind them that random walks are jagged! Encourage them to compare their final positions—they will be shocked at how far apart they end up despite starting at the same point.
Correlation Over Time Slides Lag & Autocorrelation
Searching for Patterns in Time
STATISTICS & PROBABILITY
The Echo of the Past
Defining the 'Lag' Operator
A Lag is a fixed time displacement. To "lag" a series is to shift it forward in time.
\[ L^k Y_t = Y_{t-k} \]
Lag 1: Yesterday vs Today
Lag 7: Last Monday vs This Monday
Time (t) Y_t Y_{t-1} 1 12 -- 2 15 12 3 14 15 4 19 14
Autocorrelation (ACF)
Correlation coefficient between a time series and its own lagged version.
Positive ACF
Momentum. If it went up yesterday, it's likely to go up today.
Negative ACF
Mean-reverting. If it went up yesterday, it's likely to crash today.
Zero ACF
Random. Past movements offer no hints about the future.
\(\rho_k = \frac{\text{Cov}(Y_t, Y_{t-k})}{\sqrt{\text{Var}(Y_t)\text{Var}(Y_{t-k})}}\)
Reading the Correlogram
The ACF Plot (Correlogram) shows the correlation for different lags (\(k\)) on the X-axis.
Significance Blue Zone
Bars sticking out beyond the "Blue Zone" represent statistically significant correlations.
Lag 0: Always 1.0 (A series is 100% correlated with itself!)
Lags 1-10: Where the magic happens.
Lag 0 Lag 1 Lag 2 Lag 3
Correlogram Creator Worksheet Correlogram Creator
Data Exploration: Calculating Self-Correlation
Skill Focus
LAG-1 ACF
Target Dataset: Daily Temperature Readings (\(^\circ\)C)
Sample Size: n=10
T122
T224
T323
T425
T527
T626
T728
T830
T929
T1031
1 Align the Lags
Fill in the Lag-1 series below by shifting the original values down by one position.
Time (t) Original \(Y_t\) Lagged \(Y_{t-1}\) 1 22 — 2 24 3 23 4 25 5 27 6 26 7 28 8 30 9 29 10 31
2 Scatter Analysis
Roughly sketch a scatter plot where the X-axis is \(Y_{t-1}\) and the Y-axis is \(Y_t\). You only have 9 pairs (T2 through T10).
PREVIOUS DAY (T-1)
CURRENT DAY (T)
Qualitative Assessment
Based on your scatter plot, estimate the correlation coefficient (\(r\)):
\(r \approx 0\)
\(r \approx 0.9\)
\(r \approx -0.9\)
Explain your reasoning:
The Prediction Test
If the temperature at T10 was 31\(^\circ\)C, and your calculated autocorrelation is high and positive, what is your prediction for T11?
Autocorrelation Teacher Guide Instructional Support
Lag & Autocorrelation
Facilitation Guide for Lesson 2
02
Learning Targets
Identify and construct "lagged" versions of a discrete time series.
Understand autocorrelation as a measure of temporal dependency.
Interpret ACF plots to distinguish between momentum, randomness, and reversal.
The Math Check
Students often struggle with the loss of data points during lagging.
If original series has \(n\) points:
- Lag 1 has \(n-1\) pairs
- Lag 2 has \(n-2\) pairs
- Lag \(k\) has \(n-k\) pairs
Remind students: We cannot correlate a value with data that doesn't exist (the "empty" slots in the table).
Discussion Starters
Q: Does temperature have a high Lag-1 ACF?
"Yes. If it's hot at 2:00 PM, it's very likely to be hot at 2:01 PM. This is high positive autocorrelation."
Q: Does a coin flip have any autocorrelation?
"No. Whether you flipped Heads 10 times in a row has zero impact on the next flip. ACF = 0 for all lags \(k > 0\)."
Activity Guide: Correlogram Creator
The student worksheet uses a simple dataset with a clear positive trend. This produces a high Lag-1 ACF.
1
The Shift: Ensure students shift values DOWN, not up.
2
The Plot: The scatter plot should show a tight diagonal line if students are correct.
3
Estimation: Don't worry about exact math; focus on the direction and strength of the relationship.
Extension Idea
Ask advanced students: "What would happen to the ACF if we subtracted the trend from this data first?" (This previews the concept of Stationarity in Lesson 4).
Detecting Signal Slides White Noise vs Signal
Detecting patterns in a chaotic world.
STOCHASTIC ANALYSIS
Pure Chaos: White Noise
A process \( \epsilon_t \) is called White Noise if:
Mean is zero: \( E[\epsilon_t] = 0 \)
Constant Variance: \( \text{Var}(\epsilon_t) = \sigma^2 \)
Zero Autocorrelation
TIME \(\rightarrow\)
"If it's purely random, the past tells you exactly NOTHING about the future."
Finding the Signal
Deterministic Signal
The "underlying truth" or pattern. Trends, seasonal cycles, or mathematical functions.
\( Y_t = f(t) + \epsilon_t \)
Audio Analogy
1 White Noise: Audio static / Snow on a TV. No melody, no rhythm.
2 Signal: A clear, steady tone or a song. Repetitive and predictable.
Identifying the Mix
Trend + Noise
Example: Global temperatures over 100 years.
Seasonal + Noise
Example: Ice cream sales by month.
Pure White Noise
Example: Measurement error in a lab.
Crucial Rule: Once you find a signal, the residuals (what's left over) should ideally be White Noise. If they aren't, you missed something!
Signal Detectives Activity Signal Detectives
REF: STOCH-03
Investigator:
Date:
Mission Briefing
A mysterious data stream has been intercepted. Your task is to analyze the waveforms and determine if they represent Pure White Noise , a Deterministic Signal , or a Mixed Process .
WAVEFORM A
Diagnosis:
White Noise
Pure Signal
Mixed
WAVEFORM B
Diagnosis:
White Noise
Pure Signal
Mixed
The Residual Test
Case Study: Climate Change
Scientists use a model where Temperature = Linear Trend + Seasonal Variation + Random Error. If the "Random Error" still has high autocorrelation, what does that tell the scientist about their model?
Zero-Mean Requirement
Why must White Noise have a mean of zero in a statistical model?
Stationary Property
Is White Noise considered "Stationary"? Why or why not?
💡
"Statistical modeling is the art of squeezing all the signal out of the data until only white noise remains."
Signal Detection Teacher Guide White Noise & Signal
Teacher Facilitation Notes
The Core Duality
Deterministic Signal
The predictable component. Examples include trends (global warming) or seasonality (holiday sales).
Stochastic Noise
The unpredictable component. Measurement error, random market fluctuations, or biological variability.
Socratic Questions
"If you remove the trend from a random walk, is what's left white noise?" (Answer: No, because random walks have 'memory'—the residuals will still be autocorrelated!)
"Why is white noise called 'white'?" (Analogy: Like white light, it contains all frequencies equally.)
Activity Keys
Waveform A
Pure Signal. Predictable sine wave. High autocorrelation (a point at peak is likely followed by another high point).
Waveform B
White Noise. Jagged, mean-reverting, no visible structure. Autocorrelation is effectively zero for all lags.
The Residual Test
Crucial point for 12th graders: If residuals are NOT white noise, your model is incomplete. It means there is still information (signal) left in the trash!
Misconception Alert
Students often think "Signal = Good" and "Noise = Bad". Remind them that in statistics, we treat noise as a necessary part of reality. Our goal is to measure the variance of the noise to understand the uncertainty of our predictions.
Stationarity Check Slides Stationarity
The Foundation of Forecasting
STABILITY IN TIME
What is Stationarity?
A time series is Stationary if its statistical properties do not change over time.
1
Constant Mean (\(\mu\))
2
Constant Variance (\(\sigma^2\))
3
Autocovariance only depends on Lag (\(k\))
STATIONARY
How Stationarity is Broken
1. Trend
The mean changes over time. Forecasting a trend without accounting for it leads to massive errors.
2. Seasonality
Mean and variance change in cycles. Correlation depends on time of year, not just lag length.
Why do we care?
Statistical models assume the "future behaves like the past."
If the mean and variance are constantly shifting, your historical averages are meaningless. Stationarity allows us to "stabilize" the data so our math actually works.
Next: Transforming data to achieve stationarity...
Stationarity Audit Worksheet Stationarity Audit
Data Integrity Check: Identifying Statistical Stability
Analyst:
Date:
Mean Check
Is the average constant or drifting?
Variance Check
Is the "swing" size changing?
Season Check
Are there repeating cycles?
Visual Inspection
Time Series Graph Stationary? Primary Violation Fig 1. Global Surface Temp
|
Yes
No
|
|
|
Fig 2. Resting Heart Rate
|
Yes
No
|
|
|
Fig 3. High Volatility Asset
|
Yes
No
|
|
Synthesis & Transformation
1. The Difference Engine
A common way to make a trended series stationary is called Differencing . If \(Y_t\) is a random walk (\(Y_t = Y_{t-1} + \epsilon_t\)), what is the result of calculating \(Y_t - Y_{t-1}\)? Is this result stationary?
2. The Forecasting Problem
Why is it dangerous to use a 10-year historical average to predict next year's value if the time series is not stationary?
Stationarity Teacher Guide Professional Resource
Stationarity Guide
Lesson 4: Statistical Consistency & Data Transformation
Level 12
The "Why" Factor
Students often ask why we can't just model the trend directly. Explain that stationary data provides a stable frame of reference . Just as you can't measure the speed of a car easily if you are also moving at a variable speed, we can't measure the "true" signals in data if the underlying mean is moving.
"Stationarity is the 'tugging the rug' test. If you can tug the timeline left or right and the statistics don't change, you have stationarity."
Discussion Roadmap
Topic 1: Economic Growth
GDP is non-stationary (it grows). To study it, economists use growth rates (the difference). Growth rates are often stationary.
Topic 2: Financial Markets
Stock prices are non-stationary. Returns (percent change) are mostly stationary. This is why traders look at returns!
Audit Key
Fig 1: Global Temp
NON-STATIONARY. Violation: Positive Trend (increasing mean).
Fig 2: Heart Rate
STATIONARY. Mean and variance remain relatively constant throughout the window.
Fig 3: Volatile Asset
NON-STATIONARY. Violation: Heteroscedasticity (changing variance/volatility).
Synthesis Answer
If \(Y_t = Y_{t-1} + \epsilon_t\), then \(Y_t - Y_{t-1} = \epsilon_t\). Since \(\epsilon_t\) is White Noise, the result is stationary! This is why differencing works.
Pedagogical Note: Some students might argue Fig 2 isn't stationary because it has "peaks". Clarify that stationarity doesn't mean constant *values*, it means constant *properties* of the random distribution generating those values.
Smoothing the Curve Slides Smoothing
Moving Averages & Trend Detection
FILTERING THE NOISE
What is a Moving Average?
A Moving Average (MA) calculates the arithmetic mean of a series within a "sliding window."
\[ MA_t = \frac{1}{k} \sum_{i=0}^{k-1} Y_{t-i} \]
"It acts like a low-pass filter, allowing slow-moving signals to pass through while blocking high-frequency noise."
Why use it?
Reveals underlying trends
Removes short-term volatility
Provides "support" lines in finance
The Power of the Window (\(k\))
Small \(k\) (k=3)
Very sensitive. Follows the data closely but keeps a lot of noise.
Large \(k\) (k=20)
Very smooth. Completely removes noise but introduces significant lag .
LAG WARNING: The larger the window, the more "delayed" your signals become!
The Golden Cross
In finance, traders often compare a Short MA (50-day) with a Long MA (200-day) .
When the 50-day crosses above the 200-day, it's a "Golden Cross"—a sign that a long-term bullish trend is starting.
CROSSOVER DETECTED
Smoothing the Curve Worksheet Smoothing the Curve
Applied Workshop: Moving Average Calculations
Analyst:
Date:
Task 1: Calculate the 3-Day Moving Average (\(k=3\))
The 3-day MA at time \(t\) is the average of the values at \(t\), \(t-1\), and \(t-2\).
Day (t) Value (\(Y_t\)) 3-Day MA 1 10 N/A 2 14 N/A 3 12 4 18 5 16 6 22 7 20
Visualizing the Lag
Plot your Original Values with a solid line and your 3-Day MA with a dashed line. Notice the shift!
DAY
VALUE
Reflection 1
Compare the peak at Day 4 (Value: 18) to the 3-day MA at Day 4. Why is the MA lower than the actual value?
Reflection 2
What would happen to the graph if we used a 7-day MA instead of 3? (Hint: Think about Day 7's calculation).
The Smoothing Paradox
A weather station uses a 30-day moving average to report "average daily temperature." If a sudden heatwave starts today and lasts for 5 days, will the moving average immediately show the full intensity of the heatwave? Why or why not?
Smoothing Teacher Guide Teacher Resource
MA & Smoothing
Lesson 5: Filtering Noise & Trend Analysis
FINALE
Key Objectives
01 Calculate Simple Moving Averages (SMA) for discrete time intervals.
02 Analyze the trade-off between smoothing (noise reduction) and lag (responsiveness).
03 Explain the impact of window size (\(k\)) on data interpretation.
Calculation Key
<table class="w-full text-[10px] text-left"><tbody><tr class="border-b border-rose-900"><td class="py-2">Day 3 MA</td><td class="text-right">12.0</td></tr><tr class="border-b border-rose-900"><td class="py-2">Day 4 MA</td><td class="text-right">14.67</td></tr><tr class="border-b border-rose-900"><td class="py-2">Day 5 MA</td><td class="text-right">15.33</td></tr><tr class="border-b border-rose-900"><td class="py-2">Day 6 MA</td><td class="text-right">18.67</td></tr><tr class="py-2 border-b border-rose-900"><td>Day 7 MA</td><td class="text-right">19.33</td></tr></tbody></table>
Notice how the MA consistently "trails" the actual value when the trend is rising.
The Smoothing Paradox
The central tension of Lesson 5 is the Responsiveness Gap. If you want a smooth line, you must accept that your data is "old news." If you want up-to-the-minute accuracy, you must accept that your data is "noisy."
Classroom Demonstrations
The Hand-Smoothing Test
Ask a student to draw a single smooth line through a scattered set of points. Then, show them how the MA does exactly what they just did intuitively, but with mathematical precision.
Financial Crossings
Look up a real stock chart (e.g., Apple or S&P 500) and turn on the 50-day and 200-day MA. Have students find a "Death Cross" (Fast crosses below Slow) and see what happened to the price after.
Sequence Finale: Synthesis
Wrap up the sequence by connecting all 5 lessons:
"We started with the Random Walk (Lesson 1), learned to detect its Autocorrelation (Lesson 2), tried to isolate Signal from White Noise (Lesson 3), realized we need Stationarity to trust our math (Lesson 4), and finally used Moving Averages to clean up the mess and see the truth (Lesson 5)."