Explore how different smoothing and trend-detection methods behave on noisy time series. Play, experiment, and build your intuition on when to use regressions, moving averages, or differencing.
Averages data points within a rolling window (±k) around the target point.
Good for: Smoothing general noise while keeping the trend aligned in time.
Limitation: Pulled heavily by extreme outliers; loses data at both edges.
Takes the middle value in a centered rolling window.
Good for: Removing spikes/outliers while keeping step changes.
Limitation: Can look blocky/stair-stepped.
Centered weighted averages that preserve specific polynomial curves.
Good for: Very smooth results without distorting curves.
Limitation: Loses more data at the edges (larger windows).
Subtracts previous value from current ($y_t - y_{t-1}$).
Good for: Removing trend to analyze stationary noise/cycles.
Limitation: Amplifies high-frequency noise.
A Centered Moving Average uses points $(t-k, \dots, t+k)$ and is aligned with the middle of the window. It does not suffer from phase lag, making it the mathematically correct choice for trend extraction and computing accurate residuals ($Original - Trend$).
A Trailing Moving Average uses only past points $(t-k, \dots, t)$. While necessary for real-time forecasting (where the future is unknown), it creates a severe "shift" (phase lag) relative to the signal, making residuals highly misleading.
Apply what you've learned. Answer correctly to earn XP and Badges!
We generated a stable series, but sensors malfunctioned causing massive spikes. Compare Moving Average (±2) and Moving Median (±2).
Question: Which method is more robust against these extreme outliers, and why?
Look at this data. We applied Linear Regression and Quadratic Regression.
Question: Why does Linear Regression fail to capture the true nature of this series?
Here is a series with a clear trend. Below it is the First Difference ($y_t - y_{t-1}$).
Question: Look at the Differenced series (bottom chart). What did differencing achieve here?
Observe Centered Moving Averages with windows ±1 (w=3) and ±3 (w=7). Notice the edges (start and end of the lines).
Question: What are two visual consequences of increasing the moving average window size?
We applied two filters to this Sine wave: a Centered MA (looks at past & future) and a Trailing MA (looks only at the past, common in trading).
Question: Why does the Trailing MA appear shifted relative to the signal, and which version is better for calculating residuals (Signal - Trend)?
| Method | Action | Handles Outliers? | Follows Curves? | Edge Data Loss? |
|---|---|---|---|---|
| Linear Reg | Global Estimate | Poorly | No | None |
| Quadratic Reg | Global Estimate | Poorly | Yes (1 bend) | None |
| Moving Avg | Local Smoothing | Poorly | Yes, but lags | Yes (depends on k) |
| Moving Median | Local Robust Smoothing | Very Well | Yes (step-like) | Yes |
| Spencer/Binomial | Local Advanced Smooth | Poorly | Very Well | High (large windows) |
| Differencing | Removes Trend | Amplifies them | Removes polynomials | Loses 1 point per order |
Created for educational exploration. Remember: There is no single "best" method. The choice depends on the nature of the data and your goal.