Two filters track one drone with the same 0.50 m error. Filter A claims ±0.50 m. Filter B claims ±0.05 m, and the truth escapes its 95% band at most steps. RMSE calls it a tie.
Drag Filter B's claimed error. Watch the red escapes vanish as its claim grows honest. Then we build, piece by piece, the tools that grade an estimator: bias and variance, error over a run, NEES, NIS, the Cramér–Rao floor, campaigns, trajectory metrics and honest success rates.
You need the Kalman filter (what P is) and a confidence interval. We build the rest from zero.
Part of the Evaluation and Analytics family, after The Statistics of Evaluation. The consistency tests follow Bar-Shalom, Li and Kirubarajan (2001); the deep debugging companion is Sensor Fusion 21: Debugging and Consistency.
Illustrative: one 200-step flight; the lateral error is smooth random noise scaled so its RMSE is exactly 0.50 m. Both lanes show the same error. The purple band is ±1.96 times the claimed error, where 95% of an honest filter's errors fall.
Chapter 0
See why an error number alone cannot pick the safe filter
You benchmark two Kalman filters on a week of drone flights. Both score a position RMSE (root mean square error, the typical distance from the truth) of 0.50 m. The table says tie. Which one do you ship?
A filter outputs two things. The estimate is where it thinks the drone is. The covariance P is its claim about how big its own error is. Filter A claims ±0.50 m. Filter B claims ±0.05 m. Same errors, but B claims ten times more certainty.
The claim drives other code. A planner keeps a margin of 3 claimed standard deviations around the drone, because 99.7% of honest errors fall inside it. A asks for 1.5 m. B asks for 0.15 m, while its real errors are 0.5 m.
The teal curve is the drone's true lateral error, spread 0.5 m. The green zone is the margin the planner keeps. Drag the filter's claim.
Exact Gaussian arithmetic: true error spread 0.5 m, margin 3 times the claimed spread. The 3-sigma rule is a common choice, used here as an example.
Put one number on the lie. Both filters make an error of e = 0.5 m at some step. Divide its square by the variance each filter claims. For A: 0.25 / 0.25 = 1, one standard deviation, an ordinary error. For B: 0.25 / 0.0025 = 100, ten standard deviations. An honest filter makes a ten-sigma error with probability 1.5 × 10−23.
So an estimator has two separate grades. Accuracy is how far the estimate is from the truth. Consistency is whether the claimed covariance matches the real errors. A filter can pass one and fail the other.
| Failure | P against the real error | What breaks |
|---|---|---|
| Overconfident | too small | margins shrink, gates reject good readings, the filter drifts while it reports all is well |
| Underconfident | too large | wide gates admit clutter, the planner over-buffers, convergence is slow |
The failure: shipping on RMSE alone. Symptom: tight, smooth tracks, then a crash on the first outlier. Measure: compare the claim with the errors (Chapters 3 and 4). Fix: demand a consistency number next to every RMSE.
Chapter 1
Split an estimator's error into a steady offset and a spread
You measure a battery voltage ten times. The true value is 5 V, and each reading has noise with a spread of 2 V. You turn the ten readings into one number. That rule is an estimator, and its output is an estimate.
Repeat the whole experiment many times and you get many estimates. Two things describe them. The bias is how far their average sits from the truth. The variance is how much they scatter around their own average.
Each dot is the estimate from one experiment. The dashed line is the true 5 V. Pick an estimator; for the shrunk mean, drag the weight.
Illustrative: true value 5 V, reading noise 2 V, 10 readings. The shrunk mean is c times the mean plus (1 − c) times a prior guess of 4 V. The read-out uses the exact formulas; the dots are a seeded sample.
What single number grades an estimator? Call the true value θ (theta) and the estimate θ̂ (theta-hat). The mean squared error (MSE) is the average of the squared miss over many repeats. It splits into the two parts above.
The MSE of theta-hat equals the bias of theta-hat squared, plus the variance of theta-hat.
Find the average estimate. Its distance from theta is the bias; square it. Add the scatter of the estimates around their average. The sum is the MSE.
With made-up numbers: the mean of 10 readings has bias 0 and variance 2²/10 = 0.4, so MSE 0.4 V². The shrunk mean with c = 0.8 toward a guess of 4 V has bias 0.2 × (4 − 5) = −0.2 and variance 0.8² × 0.4 = 0.256. MSE = 0.04 + 0.256 = 0.296 V².
The shrunk mean is biased, yet it wins: 0.296 against 0.4. It trades a small offset for less scatter. The trade only pays while the prior guess is close. With a guess of 1 V, the same estimator scores 0.896.
| Estimator | Bias (V) | Variance (V²) | MSE (V²) |
|---|---|---|---|
| Mean of 10 | 0 | 0.400 | 0.400 |
| Mean of first 5 | 0 | 0.800 | 0.800 |
| Shrunk, c = 0.8, guess 4 V | −0.200 | 0.256 | 0.296 |
| Shrunk, c = 0.8, guess 1 V | −0.800 | 0.256 | 0.896 |
The failure: grading by one lucky run. Symptom: an estimator wins on Tuesday and loses on Wednesday. Measure: repeat the experiment and compute bias and variance separately. Fix: report both, so a reader sees which part to attack.
Chapter 2
Turn an error that changes every step into numbers that keep its story
Your car's release note says "RMSE: 0.41 m." A safety reviewer asks: sideways or along the road? Steady, or spiking in turns? One number answers neither.
A filter's error changes every step. Call the true position minus the estimate at step t the error et, and the number of steps T. RMSE squares each error, averages, and takes the square root.
RMSE equals the square root of one over T, times the sum over t of e-t squared.
Square the error e-t at every step. Add the squares and divide by T. Take the square root. Squaring makes one big miss count more than many small ones.
With made-up numbers, five steps: x errors 0.3, −0.4, 0.5, 0.2, −0.1 m and y errors 0.1, 0.2, −0.3, 0.4, 0 m. Squared distances 0.10, 0.20, 0.34, 0.20, 0.01 sum to 0.85. RMSE = √(0.85/5) = √0.17 = 0.412 m.
Slice it. RMSE in x alone is √0.11 = 0.332 m, in y √0.06 = 0.245 m, and 0.11 + 0.06 = 0.17. For a car, 0.4 m along the road is a small stop error; 0.4 m sideways is a lane departure. Never add metres and radians into one score.
Now the trap. The last step's error is √(0.1² + 0²) = 0.1 m. A report that quotes only the terminal error claims 0.1 m. The run's RMSE is 0.412 m, 4.1 times worse, and the worst step, 0.583 m at step 3, vanishes.
The teal curve is the error at each step. The lines are three summaries of it. Pick a failure and see which summary goes blind.
Illustrative error curves, 300 steps. The shapes match common causes: drift from a slow bias, spikes from model mismatch in turns, a loop closure that snaps the estimate back at the end.
Across runs the same care applies. Ten missions score 0.30, 0.32, 0.28, 0.35, 0.31, 0.29, 0.33, 0.30, 0.34 and 4.10 m. The mean is 0.692 m; the median is 0.315 m. The mean blames every run; the median hides the crash. The honest line is: median 0.315 m, mean 0.692 m, max 4.10 m, 1 failure in 10.
The failure: one scalar for a safety system. Symptom: a good number and an angry reviewer. Measure: plot the error over time, per axis. Fix: report RMSE per axis, the max, the curve, and the failure count. Summarizing Distributions builds the box plot and the ECDF for those ten runs.
Chapter 3
Measure each error in units of the covariance the filter claims
Chapter 0 divided one squared error by one claimed variance. Now do it for a whole state, with correlations, and get a test with a known answer.
Call the true state minus the estimate the error vector e. Call the filter's claimed covariance P. The normalized estimation error squared (NEES), written η (eta), measures e in units of P.
Eta equals e-transpose times P-inverse times e.
Measure the error e in units of the claimed spread P, in every direction, and square it. In one dimension, eta is e squared over the claimed variance.
With made-up numbers: e = (0.3, −0.4) m and P = diag(0.09, 0.04) m². η = 0.09/0.09 + 0.16/0.04 = 1 + 4 = 5.0.
If the filter is honest, η is the sum of n squared standard normal numbers. That is a chi-square distribution with n degrees of freedom, and its average is n. A 2-D position filter averages NEES 2.
Correlation matters. Claim P = [[0.09, 0.02], [0.02, 0.04]], which says x and y errors move together. Its determinant is 0.0032, so P−1 = [[12.5, −6.25], [−6.25, 28.125]]. The same error, with opposite signs, now scores η = 7.125, not 5.0.
Teal dots are real errors from 200 runs. Purple rings are the claimed 1, 2 and 3 sigma ellipses. The bar is the average NEES of 50 runs against its green band.
Illustrative: true error spreads 0.3 m in x and 0.2 m in y. Expected NEES is the trace of P−1 times the true covariance. Red dots have NEES above 7.38.
One sample is weak evidence: for n = 2, 95% of honest values fall between 0.051 and 7.38. Average N runs instead. The sum is chi-square with N·n degrees of freedom, so the band for the average is the chi-square points divided by N. For 50 runs and n = 2, it is 1.484 to 2.591.
| Average NEES | Verdict | Usual cause |
|---|---|---|
| above the band | overconfident | Q or R too small, or a bias |
| inside the band | consistent | errors match P |
| below the band | underconfident | Q or R too large |
The failure: an alarm on one sample. Symptom: a team "fixes" a healthy filter after one NEES of 8. Measure: the average over runs, against the band for that N. Fix: act only on a persistent average outside the band. NEES needs the true state, so it runs in simulation or against motion capture.
Chapter 4
Grade each reading's surprise against the filter's own forecast
Your robot runs in a customer's warehouse. There is no motion capture, so NEES is off the table. But before each reading arrives, the filter forecasts it. Reality grades that forecast many times a second.
The innovation ν (nu) is the reading minus the forecast reading. The filter also forecasts how big ν should be: the innovation covariance S, its state doubt pushed into reading units plus the sensor noise. The normalized innovation squared (NIS), written ε (epsilon), measures ν in units of S.
Epsilon equals nu-transpose times S-inverse times nu.
Take the surprise nu in this reading. Measure it in units of the spread S the filter forecast for it, and square it. Every input is already inside the filter.
With made-up numbers: ν = (1.2, −0.8) and S = [[4, 1], [1, 2]]. det S = 7, so S−1ν = (3.2/7, −4.4/7) = (0.457, −0.629). ε = 1.2 × 0.457 + 0.8 × 0.629 = 1.051.
If the filter is honest, ε is chi-square with m degrees of freedom, where m is the size of one reading, not the state. A 6-state filter with 2-D position readings has NEES 6 and NIS 2. Copying the wrong one is a classic bug.
The same number is the validation gate: skip a reading whose NIS exceeds the 99% point, 9.21 for m = 2. Now watch an overconfident filter. The true S is 4, but the filter thinks 0.25. An ordinary ν = 2 has true NIS 4/4 = 1, but the filter computes 4/0.25 = 16, past its 1-D gate of 6.63. It throws the good reading away, drifts, and throws the next one away too.
Pink dots are NIS per reading. The line is the mean of the last K. A fault starts at reading 200. Pick a fault, then drag K.
Illustrative: 1-D readings, honest innovations drawn with S = 1. Bias adds one standard deviation; R doubles makes the true spread 1.6; the broken model makes the innovations larger and correlated. The band is the 95% chi-square band for the mean of K values.
The window is a trade. For K = 100 and m = 2 the band is 1.627 to 2.411; a short window reacts fast but false-alarms more. NIS also has a blind spot. A state no sensor sees, such as yaw with position-only readings, can drift while every innovation looks perfect.
The failure: trusting NIS alone. Symptom: the monitor stays green while the map warps. Measure: NEES in simulation for the whole state. Fix: NEES on the bench, NIS on the robot. Sensor Fusion 21 adds the whiteness test and a tuning runbook.
Chapter 5
Compute the best variance any unbiased estimator can reach
You tuned Q and R for three days, and the variance stopped falling. Is the tuning bad, or is there no more to get from these sensors? The data hold a fixed amount of information, and you can count it.
Fisher information measures how sharply the likelihood peaks around the true value. A sharp peak pins the value down; a flat one cannot. For a constant a measured N times with Gaussian noise of spread σ (sigma), each reading adds 1/σ² of information. Independent readings add, so the total is I = N/σ².
The variance of a-hat is at least one over I, where I equals N over sigma squared.
Each reading carries one over sigma squared of information. Add it over the N readings to get I. No unbiased estimator scatters less than one over I.
With made-up numbers: N = 25, σ = 2 V. I = 25/4 = 6.25, so the floor is 1/6.25 = 0.16 V², a spread of √0.16 = 0.4 V.
An estimator's efficiency is the floor divided by its variance. The mean of all 25 has variance 4/25 = 0.16: efficiency 1.0, it uses every bit. The mean of the first 10 has variance 0.4: efficiency 0.4. The median of Gaussian data reaches about 2/π = 0.64 as N grows.
The yellow line is the floor σ²/N. Teal is the mean, warm the first 10, blue the median. Drag N and σ.
Exact for the two means. The median curve uses the large-N formula πσ²/(2N); a seeded simulation gives efficiency 0.65 at N = 25 and 0.72 at N = 10.
Use it to decide between work and money. If your filter's Monte Carlo variance is 0.4 against a floor of 0.16, the gap is the algorithm's. If it is 0.17, stop tuning: only better sensors lower the floor. Halving σ cuts it to 0.04.
Sensors must be independent to add. Two receivers with σ = 2 each give variance 2.0, so the spread falls from 2.0 to 1.41, a 29% gain, not 50%. If their errors correlate at 0.8, the best mix has variance 4 × 1.8/2 = 3.6: a 5% gain. Diversity adds information; duplicates do not.
The failure: tuning against a wall. Symptom: weeks of tuning, no gain. Measure: plot Monte Carlo variance against the floor. Fix: stop when the gap is small. For a linear model with Gaussian noise, the Kalman filter's P equals the bound; for a nonlinear filter, the gap measures what linearization costs (see the EKF).
Chapter 6
Run many seeded trials and pair them to see a small difference
Your new filter beat the old one on one run: 0.45 m against 0.50 m. You change the noise seed, and it loses. One run of a random system is an anecdote.
A Monte Carlo campaign runs M trials. Fix the scenario. Randomize what nature randomizes: noise seeds, start errors, gusts. Log the full error and covariance traces, not only summaries.
How sure is the campaign's number? Fifty runs give a mean squared error of 0.25 m² with a spread of 0.10 m² across runs. The standard error is 0.10/√50 = 0.0141. The 95% interval is 0.222 to 0.278 m², so RMSE is 0.471 to 0.527 m. The one-run gap of 0.05 m sits inside that noise. Halving the interval costs 4 times the runs.
The campaign also checks the claim, axis by axis. At one time, the errors across runs have variance 0.36 m² in x while P claims 0.09. The ratio is 4, so the real spread is √4 = 2 times the claimed one on that axis.
Now compare two filters. Call filter A's error on one run A, filter B's B, and their difference D = A − B. If both filters see the same seed, a hard gust hurts both, so A and B rise together.
The variance of D equals the variance of A plus the variance of B, minus two times the covariance of A and B.
Add the scatter of A and the scatter of B. If both filters share each seed, subtract twice their shared movement. The shared luck cancels in the difference D.
With made-up numbers: Var(A) = Var(B) = 0.01 and correlation 0.9, so Cov = 0.009. Unpaired: Var(D) = 0.02. Paired: 0.02 − 0.018 = 0.002, ten times smaller, so about ten times fewer runs.
Each dot is one run's difference A − B in RMSE. The band is the 95% interval on the mean difference. Add runs, then switch pairing.
Illustrative: each filter's RMSE has run-to-run variance 0.01 m²; a shared seed gives correlation 0.9; B is truly 0.03 m better. Seeded draws.
The failure: more runs of one scenario. Symptom: 10,000 runs of a straight line, then a crash in a turn. Measure: list the scenario families the campaign covers. Fix: spread runs across families first, then pair seeds within each. Never draw start errors from the filter's own P: that assumes the consistency you test.
Chapter 7
Separate global drift from local jitter in a SLAM or odometry run
Two mapping robots drive one warehouse loop. Robot 1's path is jagged but ends where it started. Robot 2's path is smooth but ends 2 m off. Which is better? They fail in different metrics.
A SLAM estimate lives in its own frame, with its own origin. So trajectory metrics start with alignment: find one rotation and translation that best lays the estimate on the truth (the Umeyama method, from an SVD). Any error that one global move can explain is forgiven.
The absolute trajectory error (ATE) is the RMSE of Chapter 2 over the aligned positions. It sees global shape: drift, warp, a failed loop closure. The relative pose error (RPE) compares motions instead. Call the estimated position at step t p̂t, the true one pt, and the step gap Δ (delta).
RPE equals the square root of the mean over t of the squared length of: p-hat at t plus delta minus p-hat at t, minus p at t plus delta minus p at t.
For each step t, take the estimated motion over delta steps and subtract the true motion. Square the length of the miss, average, and take the root. A global offset cancels, so RPE needs no alignment.
With made-up numbers: truth (0,0), (1,0) … (4,0); a zigzag estimate with y = 0, 0.2, −0.2, 0.2, −0.2; Δ = 1. Motion misses in y: 0.2, −0.4, 0.4, −0.4. RPE = √(0.52/4) = 0.361 m.
Now a drift estimate on the same truth: y = 0, 0.1, 0.2, 0.3, 0.4. Anchor both estimates at the first pose and compare.
| Estimate | ATE, first-pose anchor | RPE, Δ = 1 | ATE, full alignment |
|---|---|---|---|
| Zigzag | 0.179 m | 0.361 m | 0.170 m |
| Drift | 0.245 m | 0.100 m | 0.007 m |
Rank by ATE and the jittery estimate wins; rank by RPE and the drifting one wins. Report both. The last column shows a protocol trap: this drift is a 5.7° heading error, one global rotation, so full alignment forgives almost all of it. The terminal error is 0.4 m over 4 m, a drift rate of 10% of distance; real visual-inertial odometry is far smaller.
The dashed grey loop is the truth; teal is the estimate. Pick a failure and its size. Align it and see what alignment forgives.
Illustrative 2-D loop of 80 poses, 1 m apart. Drift is a small heading error added at every step; zigzag is alternating sideways noise. Alignment is a least-squares rotation and translation, no scale.
The failure: a number without its protocol. Symptom: one paper aligns with scale (Sim(3)) and another without (SE(3)). Measure: read the alignment, the pose set and Δ. Fix: pin them in a shared tool such as evo. For the mapping side see Classical SLAM and Modern SLAM.
Chapter 8
Put an interval on a small number of robot trials, and weight success by path
A paper says "85% success" from 20 trials. Another says "75%" from 200. Which robot is better? With these numbers, you cannot tell.
Real trials cost setup time and hardware, so 10 to 50 trials is common. A robot that truly succeeds 75% of the time, run 20 times, gives 11 to 18 successes in 95% of campaigns: 55% to 90%. The textbook interval p ± 1.96√(p(1−p)/n) fails here: at 20 of 20 it says 100% to 100%.
The Wilson score interval stays inside 0 to 1 and covers well at small n. Call the observed rate p̂ (p-hat), the trial count n, and the normal point for 95% z = 1.96.
The center is p-hat plus z squared over 2 n, all over 1 plus z squared over n. The half-width is z times the root of p-hat times 1 minus p-hat over n, plus z squared over 4 n squared, all over the same 1 plus z squared over n.
Pull p-hat toward one half by an amount that grows as n shrinks. That is the center. Add and subtract the half-width, which also grows as n shrinks.
17 of 20: p̂ = 0.85, z²/n = 0.192. Center = 0.946/1.192 = 0.794. Half-width = 1.96 × √0.008776 / 1.192 = 0.154. Interval: 64.0% to 94.8%, thirty points wide.
The interval leans down: 21 points below 85%, 10 above. The 75% robot at 150 of 200 gives 68.6% to 80.5%, inside the first interval. The data cannot rank them.
Green ticks succeed, red crosses fail. The bar is the observed rate with its Wilson interval. Run trials, then try paper mode.
Illustrative seeded trials. Paper mode reruns batches of 20 until one reaches 90% or more, the winner's curse; for a true 75% robot, the best of 5 batches does that 38% of the time.
Success alone rewards a robot that wanders until it arrives. SPL (success weighted by path length) counts each success as shortest path over the longer of shortest and actual path. Five episodes, (shortest, actual) = (10, 12), (8, 8), a failure, (5, 20), a failure: (0.833 + 1 + 0 + 0.25 + 0)/5 = 0.417. Success says 60%; SPL says 41.7%.
The failure: the winner's curse. Symptom: a checkpoint chosen on the same trials it reports, which then does worse. Measure: count how many batches or checkpoints you tried. Fix: choose on one set and report on a held-out set.
Chapter 9
Mistune a filter in both directions and watch NEES and NIS catch it
Here every test runs on one filter. A Kalman filter tracks a target that moves along a line and sometimes speeds up. The world has a true sensor noise Rtrue and a true motion noise Qtrue. The filter is told Rf and Qf. Consistency asks what happens when they differ.
First, the arithmetic of one update. The filter's prior variance is P−. It thinks the sensor variance is Rf, so it sets the gain K = P−/(P− + Rf) and claims a variance of (1 − K)P−. But the reading's real variance is Rtrue. The real error variance after the update is:
Sigma squared actual equals one minus K, squared, times P-minus, plus K squared times R-true.
The update keeps a share of the old error and adds a share of the reading's noise. Square each share and weight it by its real variance. Compare the sum with the filter's claim, one minus K times P-minus.
With made-up numbers: P− = 1, Rf = 1, Rtrue = 4. K = 0.5. Claim: 0.5. Actual: 0.25 × 1 + 0.25 × 4 = 1.25. Expected NEES = 1.25/0.5 = 2.5, against an honest 1.
One step at 2.5 is inside the 1-D band, 0.001 to 5.02. The 50-run average band is 0.647 to 1.428, and 2.5 is far above it. Told the truth, Rf = 4, the gain is 0.2 and the actual variance is 0.64 + 0.16 = 0.80. The honest filter claims more doubt and has less error: the lie also broke the fusion.
Top: the estimate's error with its claimed band. Below: windowed NEES (purple) and NIS (pink) against green bands. Load a preset or drag the dials.
Illustrative: a constant-velocity filter (position and velocity, so NEES has 2 degrees of freedom; NIS has 1), 400 steps, sensor error 2 m, with two speed-ups. Bands are for the mean of the last 50 steps. Hide truth blanks NEES, as on a deployed robot.
| Preset | What the dials say | What the lanes show |
|---|---|---|
| Overconfident | R told ÷4 | both above the band; RMSE barely moves |
| Underconfident | R told ×4 | both below the band; RMSE rises, because the wrong gain wastes readings |
| Q too small | Q told ÷100 | P collapses; NEES and NIS shoot far above the band, and RMSE more than triples |
| Compensating | Q and R both ×4 | same gain and same RMSE, but NEES and NIS fall to a quarter |
The last row is the trap. The gain depends on Q and R only through their balance, so scaling both leaves the estimates and the RMSE unchanged. Only the consistency tests see the absolute scale, and the absolute scale is what every consumer of P reads.
The failure: tuning Q and R to minimize RMSE. Symptom: a great RMSE and a P off by any factor. Measure: windowed NIS on logs, NEES in simulation. Fix: fix bias first, set the Q to R balance, then scale both until NIS sits in its band, and gate it in CI with regression testing.
Chapter 10
Keep the tests, their numbers and the core code on one page
An estimator makes a claim, and you grade it twice: how far it is from the truth, and whether its claim matches its errors. Grade accuracy per axis and over time. Test the claim with NEES on the bench and NIS on the robot. Compare against the floor. Run campaigns with paired seeds. Report trajectories with ATE and RPE, and trials with intervals.
| Tool | Equation | Worked numbers |
|---|---|---|
| MSE | Bias² + Var | 0.04 + 0.256 = 0.296 V² |
| RMSE | √(1/T · Σ et²) | √(0.85/5) = 0.412 m |
| NEES | η = eTP−1e, honest mean n | 5.0 diagonal, 7.125 correlated |
| Band, average of N | χ² points of N·n, over N | n 2, N 50: 1.484 to 2.591 |
| NIS | ε = νTS−1ν, honest mean m | 1.051; gate 9.21 at m 2 |
| CRLB | Var ≥ 1/I, I = N/σ² | N 25, σ 2: 0.16 V² |
| Paired difference | Var A + Var B − 2 Cov | 0.02 to 0.002 |
| RPE | RMSE of motion misses | zigzag 0.361 m, drift 0.100 m |
| Wilson | center ± half-width | 17 of 20: 64.0% to 94.8% |
| SPL | mean of success × shortest/max(shortest, actual) | 0.417 vs success 60% |
| Mistuned update | (1−K)²P− + K²Rtrue | 1.25 actual vs 0.5 claimed |
| Term | Meaning |
|---|---|
| Bias | The average estimate minus the truth. |
| Consistent | Errors average zero and their spread matches the claimed P. |
| NEES | The true error squared in units of P; needs the truth. |
| NIS | The innovation squared in units of S; needs no truth. |
| Efficiency | The Cramér–Rao floor divided by the estimator's variance. |
| ATE | RMSE of aligned positions: global shape. |
| RPE | RMSE of motion over a gap: local accuracy. |
| SPL | Success weighted by path efficiency. |
pythonimport numpy as np from scipy.stats import chi2 def nees(e, P): return float(e @ np.linalg.solve(P, e)) # solve is stabler than inv def nis(nu, S): return float(nu @ np.linalg.solve(S, nu)) def band(dof, N, conf=0.95): # band for the mean of N values a = (1 - conf) / 2 return chi2.ppf(a, N * dof) / N, chi2.ppf(1 - a, N * dof) / N def rmse(err): return np.sqrt((err ** 2).sum(axis=-1).mean()) # err: (T, d) def rpe(gt, est, d=1): # positions (T, 2) return rmse((est[d:] - est[:-d]) - (gt[d:] - gt[:-d])) def wilson(k, n, z=1.959964): p = k / n; den = 1 + z * z / n c = (p + z * z / (2 * n)) / den h = z * np.sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / den return c - h, c + h band(2, 50) # (1.484, 2.591) wilson(17, 20) # (0.640, 0.948)
Now press Present or Teach and explain, from memory, why two filters with one RMSE can differ in safety, and how NEES and NIS catch the liar. Then go back to the hero and drag Filter B's claim until its red marks stop.