pub struct FitInference {Show 19 fields
pub edf_by_block: Vec<f64>,
pub penalty_block_trace: Vec<f64>,
pub edf_total: f64,
pub smoothing_correction: Option<Array2<f64>>,
pub smoothing_correction_method: Option<SmoothingCorrectionMethod>,
pub smoothing_correction_first_order: Option<Array2<f64>>,
pub smoothing_correction_method_first_order: Option<SmoothingCorrectionMethod>,
pub penalized_hessian: UnscaledPrecision,
pub reparam_qs: Option<Array2<f64>>,
pub dispersion: Dispersion,
pub beta_covariance: Option<PhiScaledCovariance>,
pub beta_standard_errors: Option<Array1<f64>>,
pub beta_covariance_corrected: Option<Array2<f64>>,
pub beta_standard_errors_corrected: Option<Array1<f64>>,
pub beta_covariance_frequentist: Option<Array2<f64>>,
pub coefficient_influence: Option<Array2<f64>>,
pub weighted_gram: Option<Array2<f64>>,
pub bias_correction_beta: Option<Array1<f64>>,
pub bias_correction_jacobian: Option<Array2<f64>>,
}Fields§
§edf_by_block: Vec<f64>§penalty_block_trace: Vec<f64>Raw per-penalty-block trace tr_kk = λ_kk·tr(H⁻¹ S_kk), one entry per
smoothing parameter (aligned 1:1 with lambdas, like edf_by_block).
Unclamped, in either coefficient basis (the trace of a matrix product is
basis-invariant). This is the quantity both the dense and survival EDF
paths already form internally; storing it lets per-term EDF be assembled
as edf_term = |coeff_range| − Σ_{kk∈term} tr_kk, which equals the trace
of the influence matrix F = H⁻¹X'WX over the term’s coefficient block,
is additive across terms, and sums exactly to edf_total. The legacy
Σ_kk(rank(S_kk) − tr_kk) block-sum over-counts whenever several
penalties share one coefficient range (te/ti, anisotropic, adaptive),
reporting a per-term EDF that can exceed the model total (issue #1219).
May be empty for fits produced before this field existed or by paths that
do not record traces; consumers fall back to coefficient_influence.
edf_total: f64§smoothing_correction: Option<Array2<f64>>§smoothing_correction_method: Option<SmoothingCorrectionMethod>Method that produced smoothing_correction. Required whenever a matrix
is present; None means no correction was retained.
smoothing_correction_first_order: Option<Array2<f64>>The exact first-order IFT smoothing-parameter-uncertainty correction,
RETAINED even when smoothing_correction/smoothing_correction_method
above hold a cubature upgrade instead. compute_smoothing_correction_auto
always computes the first-order correction before deciding whether to
escalate to sigma-point cubature; discarding it once cubature is chosen
made the #946 WPS-corrected-EDF/AIC channel go dark precisely when
smoothing-parameter uncertainty is large enough to matter — the regime
the correction exists for (see model_comparison_from_unified’s
method_certified_exact gate, which is exact-provenance-only by
design). Some exactly when smoothing_correction_method_first_order
is Some(FirstOrderIdentifiedSubspace{..}); None when the first-order
geometry itself was unavailable (mirrors smoothing_correction in that
case — there is nothing to retain either way).
smoothing_correction_method_first_order: Option<SmoothingCorrectionMethod>Provenance for smoothing_correction_first_order. Always either None
or Some(FirstOrderIdentifiedSubspace{..}) — this field never holds
SigmaPointCubature, unlike smoothing_correction_method above.
penalized_hessian: UnscaledPrecisionPenalised Hessian H = X'W_HX + S(λ) with NO dispersion scaling.
When UnifiedFitResult::geometry is present, this matrix shares its
exact active coefficient frame and therefore has dimension
geometry.coefficient_gauge.reduced_total(). Without saved geometry it
is in the saved/raw coefficient frame.
Stored as [UnscaledPrecision] so callers that need the φ-scaled
covariance Vb know they must pair this with Self::dispersion.
#[serde(transparent)] on the newtype keeps the on-disk encoding
identical to the pre-newtype Array2<f64> storage.
reparam_qs: Option<Array2<f64>>§dispersion: DispersionDispersion/scale used to scale all coefficient covariance matrices.
Dispersion is a validated newtype with no meaningful default (its
source tag and φ are always established by the fit), so this field is
required on the wire — no #[serde(default)], which would both demand a
nonexistent Default impl and silently fabricate an unvalidated scale.
beta_covariance: Option<PhiScaledCovariance>Conditional Bayesian covariance under fixed smoothing parameters (mgcv
Vb). In an unreduced coefficient frame, Vb = H^{-1} * phi. With an
active geometry gauge β = Tθ + a, the saved/raw covariance is
Vb = T H_θ^{-1} Tᵀ * phi. Do not use an unscaled H^{-1} for
standard errors when scale is estimated.
beta_standard_errors: Option<Array1<f64>>Marginal SEs from beta_covariance.
beta_covariance_corrected: Option<Array2<f64>>Optional smoothing-parameter-corrected Bayesian covariance (mgcv Vp):
Vp = Vb + V_lambda, on the same dispersion scale as Vb. Usually
this is first-order: Var*(β) ≈ Var(β|λ) + J Var(ρ) J^T; high-risk
regimes may use adaptive cubature for higher-order terms.
beta_standard_errors_corrected: Option<Array1<f64>>Marginal SEs from beta_covariance_corrected (Vp).
beta_covariance_frequentist: Option<Array2<f64>>Frequentist covariance Ve = H⁻¹ X’WX H⁻¹ * φ̂.
coefficient_influence: Option<Array2<f64>>Coefficient-space influence matrix F = H⁻¹ X’WX. Its trace is the total EDF.
weighted_gram: Option<Array2<f64>>Weighted Gram X'WX = H − S(λ) in the original coefficient basis —
symmetric PSD by construction. Stored directly (issue #1027) so the
Wood–Pya–Säfken corrected-EDF correction tr(X'WX·Σ_ρ) pairs the true
PSD Gram with Σ_ρ, rather than reconstructing it as H·F from a
Hessian surface that need not satisfy H·F = X'WX (which made the
correction indefinite and the corrected EDF drop below the conditional).
bias_correction_beta: Option<Array1<f64>>O(n⁻¹) frequentist bias-correction vector b̂ = H⁻¹ S(λ̂) β̂ in the original (untransformed) coefficient basis. Predictions apply η̂_BC(x) = η̂(x) + s_*(x)^T b̂ to remove first-order shrinkage bias.
bias_correction_jacobian: Option<Array2<f64>>O(n⁻¹) frequentist bias-correction Jacobian A = I + H⁻¹ S(λ̂) — the
fixed-ρ linearization dβ_BC/dβ̂ of the bias-corrected coefficient
β_BC = β̂ + b̂. A credible band centred at β_BC must report the
covariance of that estimator, A·V·Aᵀ. The smoothing-corrected
covariance already folds A in (see the optimizer), but the conditional
covariance is stored raw, so prediction applies A to the conditional
band through this Jacobian to avoid the over-narrow band #1870 documents.
None when the full inverse (hence A) was unavailable.
Implementations§
Source§impl FitInference
impl FitInference
pub fn validate_numeric_finiteness(&self) -> Result<(), EstimationError>
Trait Implementations§
Source§impl Clone for FitInference
impl Clone for FitInference
Source§fn clone(&self) -> FitInference
fn clone(&self) -> FitInference
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FitInference
impl Debug for FitInference
Source§impl<'de> Deserialize<'de> for FitInference
impl<'de> Deserialize<'de> for FitInference
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for FitInference
impl RefUnwindSafe for FitInference
impl Send for FitInference
impl Sync for FitInference
impl Unpin for FitInference
impl UnsafeUnpin for FitInference
impl UnwindSafe for FitInference
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.