Skip to main content

FitInference

Struct FitInference 

Source
pub struct FitInference {
Show 17 fields pub edf_by_block: Vec<f64>, pub penalty_block_trace: Vec<f64>, pub edf_total: f64, pub smoothing_correction: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>, pub penalized_hessian: UnscaledPrecision, pub working_weights: ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, pub working_response: ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, pub reparam_qs: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>, pub dispersion: Dispersion, pub beta_covariance: Option<PhiScaledCovariance>, pub beta_standard_errors: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>, pub beta_covariance_corrected: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>, pub beta_standard_errors_corrected: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>, pub beta_covariance_frequentist: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>, pub coefficient_influence: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>, pub weighted_gram: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>, pub bias_correction_beta: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>,
}

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<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>§penalized_hessian: UnscaledPrecision

Raw penalised Hessian H = X'W_HX + S(λ) with NO dispersion scaling. 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.

§working_weights: ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>§working_response: ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>§reparam_qs: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>§dispersion: Dispersion

Dispersion/scale used to scale all coefficient covariance matrices.

§beta_covariance: Option<PhiScaledCovariance>

Conditional Bayesian covariance under fixed smoothing parameters (mgcv Vb): Vb = H^{-1} * phi, where H = X'W_HX + S(lambda) and phi is dispersion. Do not use an unscaled H^{-1} for standard errors when scale is estimated.

§beta_standard_errors: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>

Marginal SEs from beta_covariance.

§beta_covariance_corrected: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>

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<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>

Marginal SEs from beta_covariance_corrected (Vp).

§beta_covariance_frequentist: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>

Frequentist covariance Ve = H⁻¹ X’WX H⁻¹ * φ̂.

§coefficient_influence: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>

Coefficient-space influence matrix F = H⁻¹ X’WX. Its trace is the total EDF.

§weighted_gram: Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>>

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<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>

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.

Implementations§

Trait Implementations§

Source§

impl Clone for FitInference

Source§

fn clone(&self) -> FitInference

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FitInference

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FitInference

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<FitInference, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for FitInference

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V