Filter tuning

Demand scenario

Playback

Filter state (live)

Observation #0
True demand (hidden)—
Raw POS reading—
Filter estimate—
Estimated trend/step—
Absolute error—
Uncertainty σ (√P₁₁)—
Current Kalman gain K—
Q is the filter's belief in how fast true demand can change on its own; R is how noisy each point-of-sale reading is. Raise Q to react faster to real regime shifts at the cost of a noisier estimate; raise R to trust the sensor less and smooth harder. The shaded band is the genuine 1σ (and 2σ) region from the filter's own error covariance P — it shrinks as the filter accumulates confidence and widens instantly after a regime shift.