pub struct AftFit { /* private fields */ }Expand description
A fitted accelerated failure time (AFT) parametric survival model,
log Tᵢ = xᵢᵀβ + σ·Wᵢ,
where W has the standard AftDistribution. Unlike the semiparametric Cox
model this specifies the full baseline, so it yields absolute time
predictions (e.g. median survival) and coefficients read as log
time-acceleration: exp(βⱼ) > 1 multiplies survival time. Fit by maximum
likelihood over right-censored data (Nelder–Mead on the log-likelihood, with
standard errors from the numerical observed information).
Implementations§
Source§impl AftFit
impl AftFit
Sourcepub fn new(
time: Array1<f64>,
event: Array1<f64>,
x: Array2<f64>,
dist: AftDistribution,
) -> Result<Self>
pub fn new( time: Array1<f64>, event: Array1<f64>, x: Array2<f64>, dist: AftDistribution, ) -> Result<Self>
Fit an AFT model of survival (time, event) on X under dist.
event[i] is 1.0 for an observed event, 0.0 for right-censoring. X
carries the fixed effects including an intercept (the model has a
location term). Returns the standard-error covariance for the β
coefficients (the scale is reported separately).
§Errors
RegressionError::EmptyInput/RegressionError::ShapeMismatch.RegressionError::InvalidResponsefor non-positive times or event flags outside{0, 1}, or no events.RegressionError::NotConvergedif the optimizer stalls.
Sourcepub fn distribution(&self) -> AftDistribution
pub fn distribution(&self) -> AftDistribution
The assumed distribution.
Sourcepub fn n_observations(&self) -> usize
pub fn n_observations(&self) -> usize
Number of observations.
Sourcepub fn n_parameters(&self) -> usize
pub fn n_parameters(&self) -> usize
Number of coefficients (design columns).
Sourcepub fn coefficients(&self) -> ArrayView1<'_, f64>
pub fn coefficients(&self) -> ArrayView1<'_, f64>
AFT coefficients β (log time-acceleration scale), aligned to the design
columns.
Sourcepub fn covariance(&self) -> ArrayView2<'_, f64>
pub fn covariance(&self) -> ArrayView2<'_, f64>
Coefficient covariance (inverse observed information).
Sourcepub fn log_likelihood(&self) -> f64
pub fn log_likelihood(&self) -> f64
Maximized log-likelihood.
Sourcepub fn coefficient_standard_errors(&self) -> Array1<f64>
pub fn coefficient_standard_errors(&self) -> Array1<f64>
Coefficient standard errors √diag(cov).
Sourcepub fn predict_median(&self, x: ArrayView2<'_, f64>) -> Array1<f64>
pub fn predict_median(&self, x: ArrayView2<'_, f64>) -> Array1<f64>
Predicted median survival time for a new design matrix x:
exp(xβ + σ·median(W)).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AftFit
impl RefUnwindSafe for AftFit
impl Send for AftFit
impl Sync for AftFit
impl Unpin for AftFit
impl UnsafeUnpin for AftFit
impl UnwindSafe for AftFit
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,
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.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.