pub fn consistency(
prior: &Prior,
estimate: &[f64],
posterior: &FlatMatrix,
) -> Result<Option<Consistency>, FittingError>Expand description
The consistency of the fitted values estimate of a prior’s
parameters with it, in the prior’s order, given the fit’s covariance
posterior of them.
With C = LLᵀ the prior covariance, z = L⁻¹(estimate − mean) and
I − L⁻¹·posterior·L⁻ᵀ = Σᵢ rᵢuᵢuᵢᵀ, rᵢ is the share of the prior’s
variance along uᵢ that the counts remove, and q = Σᵢ (uᵢᵀz)²/rᵢ over
the dof directions with rᵢ ≥ 8e-4. If the prior and the counts’ model
are right and estimate and posterior are the fit’s without its bounds
(Unbounded), q follows χ² with dof
degrees of freedom, and p = P(χ²_dof ≥ q).
None when posterior is not finite or no direction has rᵢ ≥ 8e-4.
§Errors
FittingError::LengthMismatch if estimate or posterior does not
match the prior’s parameters; FittingError::InvalidConfig if the prior’s
mean is not finite or a measured sd not finite and positive, estimate is
not finite while posterior is, or posterior is not symmetric to 1e-12
of √(Σᵢᵢ Σⱼⱼ) or not within the prior, with some rᵢ below −8e-4 or
above 1 + 8e-4, or q is not a number, as overflow in whitening can
give; FittingError::EvaluationFailed if a decomposition fails.