pub struct CoxPHModel { /* private fields */ }Expand description
Cox proportional hazards model.
Wraps CoxPH with a slice-based interface.
Implementations§
Source§impl CoxPHModel
impl CoxPHModel
Sourcepub fn fit(
times: &[f64],
events: &[bool],
covariates: &Array2<f64>,
) -> StatsResult<Self>
pub fn fit( times: &[f64], events: &[bool], covariates: &Array2<f64>, ) -> StatsResult<Self>
Fit the Cox PH model via Newton-Raphson partial likelihood optimisation.
§Arguments
times– observed event/censoring times.events– event indicators.covariates– n_samples × n_features covariate matrix.
Sourcepub fn coefficients(&self) -> Vec<f64>
pub fn coefficients(&self) -> Vec<f64>
Log hazard-ratio coefficients β.
Sourcepub fn standard_errors(&self) -> Vec<f64>
pub fn standard_errors(&self) -> Vec<f64>
Standard errors of the coefficients.
Sourcepub fn hazard_ratios(&self) -> Vec<f64>
pub fn hazard_ratios(&self) -> Vec<f64>
Hazard ratios exp(β).
Sourcepub fn predict_risk(&self, x: &[f64]) -> f64
pub fn predict_risk(&self, x: &[f64]) -> f64
Predict risk score exp(Xβ) for a single observation given as a slice.
Sourcepub fn concordance_index(
&self,
times: &[f64],
events: &[bool],
covariates: &Array2<f64>,
) -> f64
pub fn concordance_index( &self, times: &[f64], events: &[bool], covariates: &Array2<f64>, ) -> f64
Concordance index (C-statistic) evaluated on provided data.
Requires the covariate matrix used at prediction time.
Sourcepub fn log_likelihood(&self) -> f64
pub fn log_likelihood(&self) -> f64
Partial log-likelihood at convergence.
Sourcepub fn n_iterations(&self) -> usize
pub fn n_iterations(&self) -> usize
Number of Newton-Raphson iterations performed.
Auto Trait Implementations§
impl Freeze for CoxPHModel
impl RefUnwindSafe for CoxPHModel
impl Send for CoxPHModel
impl Sync for CoxPHModel
impl Unpin for CoxPHModel
impl UnsafeUnpin for CoxPHModel
impl UnwindSafe for CoxPHModel
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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 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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.