#[non_exhaustive]pub struct PeerResult {
pub beta: Vec<f64>,
pub intercept: f64,
pub w_bar: Vec<f64>,
pub fitted_values: Vec<f64>,
pub effective_df: f64,
pub lambda: f64,
pub penalty_type: PeerPenalty,
pub gcv: Option<f64>,
pub lambda_method: LambdaMethod,
}Expand description
Result of the peer estimator.
Carries the estimated coefficient function β(t), model diagnostics, and
the penalty configuration used — all on the argvals grid.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.beta: Vec<f64>Estimated coefficient function β(t), length m (on the argvals grid).
intercept: f64Intercept (= ȳ, the mean of the response vector).
This is the centered-response mean, not the out-of-sample prediction
intercept. Prediction on a new curve x* uses
ȳ + Σ_j (x*[j]·w[j] − w_bar[j])·β[j] = (ȳ − w_bar·β) + Σ_j x*[j]·w[j]·β[j],
so a predictor must combine intercept with w_bar and
beta. Storing w_bar here keeps that reconstruction exact (consumed by
out-of-sample prediction in a later phase).
w_bar: Vec<f64>Column means of the Simpson-weighted design W[i,j] = data[(i,j)]·w[j],
length m. Retained so out-of-sample prediction can reproduce the same
centering the fit used (see intercept).
fitted_values: Vec<f64>Fitted values ŷ_i, length n.
effective_df: f64Effective degrees of freedom tr(H) = tr((W_c’W_c + λQ)^{-1} W_c’W_c).
lambda: f64Smoothing parameter λ that was used.
penalty_type: PeerPenaltyPenalty family that was used.
gcv: Option<f64>GCV score at the selected λ. Some(score) when LambdaMethod::Gcv
ran; None when LambdaMethod::Fixed or LambdaMethod::Reml.
lambda_method: LambdaMethodWhich λ-selection path ran.
Implementations§
Source§impl PeerResult
impl PeerResult
Sourcepub fn predict(
&self,
new_data: &FdMatrix,
argvals: &[f64],
) -> Result<Vec<f64>, FdarError>
pub fn predict( &self, new_data: &FdMatrix, argvals: &[f64], ) -> Result<Vec<f64>, FdarError>
Predict scalar responses for new functional observations.
Applies the fitted PEER coefficient function β(t) to new_data via
ŷ*[i] = (intercept − w_bar·β) + Σ_j x*[i,j] · w[j] · β[j]
where w = simpsons_weights(argvals).
Self-consistency: re-passing the training data and training argvals
reproduces the training fitted_values to within
floating-point rounding (≤ 1e-9 in absolute error per observation).
§Errors
Returns FdarError::InvalidDimension when new_data.ncols() or
argvals.len() does not equal the number of training grid points m.
Trait Implementations§
Source§impl Clone for PeerResult
impl Clone for PeerResult
Source§fn clone(&self) -> PeerResult
fn clone(&self) -> PeerResult
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 PeerResult
impl Debug for PeerResult
Source§impl PartialEq for PeerResult
impl PartialEq for PeerResult
impl StructuralPartialEq for PeerResult
Auto Trait Implementations§
impl Freeze for PeerResult
impl RefUnwindSafe for PeerResult
impl Send for PeerResult
impl Sync for PeerResult
impl Unpin for PeerResult
impl UnsafeUnpin for PeerResult
impl UnwindSafe for PeerResult
Blanket Implementations§
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,
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,
impl<T> Scalar for T
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.