Residual and Window Calculation Audit
Residual and Window Calculation Audit
Ada re-derives this chapter’s own numbers step by step, at full precision
ADA · CALCULATION AUDIT
Residual and Window Calculation Audit
At weekday 02:00 a seasonal baseline forecasts 18 kW but the meter reports 31 kW, leaving a 13 kW residual against an expected ±4 kW band — and the five-minute window that should hold 10 readings has only 8. This audit asks whether the alert should judge that 13 kW residual rather than the raw 31 kW, and whether an 80%-complete window can be trusted before a two-window rule confirms at 10 minutes.
Companion to the chapter Time-Series Anomaly Methods — every number here comes from that chapter.
Time-series scoring is subtraction, then comparison: the residual — not the raw reading — is what crosses the threshold, and it only means anything on a complete window. Every number below is one this chapter's worked example already gave.
See the relationship before changing it
The figure reads from left to right. The blue card is seasonal forecast. The middle card applies this page's rule. The green card is observed residual. Walk the arrows once: set the input, apply the rule, then read the result with its unit.
The retained audit below checks several chapter fixtures. This model keeps those stated values fixed and changes only seasonal forecast, so the numeric fixture does not switch without explanation.
Derive the baseline in four named moves
- 1
Name the input. The chapter baseline is 18 kW.
- 2
Name the relationship. residual = 31 kW observed - forecast
- 3
Substitute with units. 31 - 18 = 13.0 kW
- 4
Read the result. Keep the unit beside the value. Use it only inside the technical boundary on this page.
Predict, then change seasonal forecast
Try Predict the direction of residual = 31 kW observed - forecast. Test another seasonal forecast, then compare observed residual.
Observe A higher forecast shrinks the residual for the same observed load; the raw observation alone is not the anomaly. Reset seasonal forecast to 18 and compare observed residual.
Explain A higher forecast shrinks the residual for the same observed load; the raw observation alone is not the anomaly.
Check yourself
What should you do before trusting a moved-control result?
What does this small model leave out?
Run Calculate for observed 31 kW, expected 18 kW, a +/-4 kW band, and 8 readings in a 10-reading window.
Check reports a 13 kW residual at 3.25x threshold but marks the 80%-complete window provisional.
The detector thresholds context-adjusted residual rather than raw load, and the two-window rule delays confirmation until completeness and persistence agree.
Technical boundaries
For the residual detector, excluded from this fixed arithmetic are concept drift, missing samples, seasonal changes, sensor faults, or correlated residuals outside the fixed window and threshold.
1. The residual is observed minus expected.
At weekday 02:00 the seasonal baseline forecasts 18 kW; the meter reports 31 kW:
2. The alert compares the residual to the band, never the raw value.
The expected residual band is ±4 kW, so the candidate rule flags when the magnitude exceeds it:
3. A streaming score is only trustworthy on a complete window.
A five-minute window sampled every 30 s should hold 300 / 30 readings, and a persistence rule delays the confirmed alert:
| Detector question | Arithmetic shown | Audit result |
| Forecast residual (observed − expected) | 31 − 18 | 13 kW |
| Threshold test (|residual| > band) | |13| > 4 | flag — exceeds ±4 kW |
| Exceedance vs the ±4 kW band | 13 / 4 | 3.25× |
| Expected readings (5-min / 30-s window) | 300 / 30 | 10 readings |
| Completeness when only 8 arrive | 8 / 10 | 80% (2 missing → provisional) |
| Earliest confirmed alert (2-window rule) | 2 × 5 min | 10 minutes |
What this means for your design: thresholding the raw 31 kW would judge the reading on the wrong basis, but the 13 kW residual sits 3.25× outside the ±4 kW band — an unambiguous flag for that 02:00 context. The same arithmetic is only safe on a full window: at 80% completeness the score is provisional, and a two-window persistence rule cannot confirm before 10 minutes. If the response deadline is shorter than that, an edge rule must raise a provisional alert first and attach the later context review to the same incident id.
Every number above is taken from the chapter’s own examples and re-derived step by step.