Skip to main content

Module bad_data

Module bad_data 

Source
Expand description

Detecting and identifying measurements that disagree with the rest.

A converged estimate is not a correct one. Weighted least squares will happily absorb a broken sensor by bending the state toward it, and the result looks exactly like a successful solve — the fixture node-injection-sensor-and-zero-injection is a worked example of how far that can go. Bad-data analysis is the step that asks whether the measurements were mutually consistent in the first place.

Two questions, answered separately:

  1. Is there bad data at all? The chi-squared test on the objective. Under the assumption that each measurement error is independent and normal with the declared sigma, J = rᵀWr is chi-squared distributed with m − n degrees of freedom. A J far out in the tail says the residuals are too large to be noise.
  2. Which measurement? The largest normalized residual. Raw residuals are not comparable — a residual of 0.1 is enormous for a sigma of 0.001 and negligible for a sigma of 1 — and dividing by sigma alone is not enough either, because a redundantly measured quantity spreads its error across its neighbours. The right scale is the residual’s own standard deviation, Ω = R − H G⁻¹ Hᵀ.

§Cost, and why only the top candidates

Ωᵢᵢ needs hᵢ G⁻¹ hᵢᵀ, i.e. one linear solve per measurement. Computing the whole diagonal costs m solves, which for a real grid is far more than the estimate itself. analyze therefore ranks candidates by the cheap proxy |rᵢ|/σᵢ, computes Ωᵢᵢ for the worst Candidates::limit of them, and reports those.

That is an approximation and worth being precise about: the true largest normalized residual can in principle sit outside the shortlist, because Ωᵢᵢ ≤ Rᵢᵢ varies per measurement. In practice the two orderings agree closely — a measurement with a large normalized residual almost always has a large raw one — but “almost always” is not “always”, and a caller that needs certainty can raise the limit to m.

Structs§

BadDataReport
The outcome of a bad-data analysis.
Candidates
How many measurements to examine in detail.
Suspect
A measurement flagged as suspect.

Functions§

analyze
Runs bad-data analysis at a converged state.
chi_squared_upper_tail
Upper-tail probability of the chi-squared distribution: the chance of observing at least x with dof degrees of freedom.