← Back to the chapter · Previous detail · Next detail →
Technical detail · Imputation and Noise Filtering
Calculate moving-average noise and delay
How does filter window size affect noise reduction and latency?
For a moving average filter with independent Gaussian noise (σ = 2.0°C) on temperature sensor:
Noise reduction formula:
Where is the window size.
| Window Size (N) | Noise Reduction | Latency (samples) | Temperature Example |
|---|---|---|---|
| 3 | 1.0 | 2.0°C → 1.15°C noise | |
| 5 | 2.0 | 2.0°C → 0.89°C noise | |
| 10 | 4.5 | 2.0°C → 0.63°C noise | |
| 20 | 9.5 | 2.0°C → 0.45°C noise |
Trade-off: Larger window → better noise rejection BUT longer delay detecting real changes.
Latency calculation: Output lags input by samples. For at 1 Hz sampling → 4.5 second delay.
Practical rule: Choose such that latency is < 10% of the timescale you care about. If monitoring hourly HVAC cycles (3600s), 5-10 sample window (2-4.5s latency) is acceptable. If detecting rapid door opening events (10s timescale), use (1.0s latency max).