pub enum FrailtySpec {
None,
GaussianShift {
sigma_fixed: Option<f64>,
},
HazardMultiplier {
sigma_fixed: Option<f64>,
loading: HazardLoading,
},
}Expand description
Frailty modifier specification at the family level.
Two structurally different exact modifiers exist:
-
GaussianShift: additive Gaussian on the final transformation index. Exact for probit families — the existing sextic microcell kernel survives unchanged (just scale denested cell coefficients by 1/√(1+σ²)).
-
HazardMultiplier: lognormal multiplier on the loaded cumulative hazard. Exact for PH/cloglog families — row likelihoods are finite sums of K_{k,m}(μ, σ) kernel terms.
These are mathematically distinct families. Do not mix them.
Variants§
None
No frailty modifier.
GaussianShift
Gaussian shift on the final scalar index: U ~ N(0, σ²) added to η. Exact for probit: E[Φ(η + U)] = Φ(η / √(1+σ²)). The existing sextic microcell kernel is preserved.
HazardMultiplier
Lognormal hazard multiplier: conditional hazard h(t|U) involves exp(U). Exact for PH/cloglog/survival via K_{k,m} kernel.
Fields
loading: HazardLoadingHow the multiplier loads onto hazard components.
Implementations§
Source§impl FrailtySpec
impl FrailtySpec
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Whether this spec requests an actual frailty modifier.
FrailtySpec::None is the sole “no frailty” value. Family/mode guards
that only support the no-frailty case must reject on this predicate, or they
misclassify every ordinary CLI fit as a frailty request.
Sourcepub fn validate(&self) -> Result<(), LognormalKernelError>
pub fn validate(&self) -> Result<(), LognormalKernelError>
Validate the frailty scale domain independently of a model family.
Sourcepub fn resolve_fixed_gaussian_shift(
&self,
context: &str,
) -> Result<Self, LognormalKernelError>
pub fn resolve_fixed_gaussian_shift( &self, context: &str, ) -> Result<Self, LognormalKernelError>
Resolve the exact frailty subset supported by Gaussian-shift marginal-slope models.
These models admit either no frailty or a Gaussian shift with a fixed standard deviation. A learnable Gaussian-shift scale and the structurally different hazard-multiplier frailty require other fitting machinery and are rejected here at the type that owns those states.
Sourcepub fn validate_for_marginal_slope(&self) -> Result<(), String>
pub fn validate_for_marginal_slope(&self) -> Result<(), String>
Validate that this frailty spec is compatible with score_warp/linkwiggle cubic marginal-slope families.
GaussianShiftis exact: the sextic microcell kernel is preserved (probit scaling by 1/τ, τ = √(1+σ²)).HazardMultiplieris exact only for PH/cloglog rowwise families. It is NOT finite-state exact with score_warp/linkwiggle cubic marginal-slope, because the multiplicative frailty breaks the polynomial kernel closure that the cubic cell derivatives require.
Returns an error if the combination is not exactly integrable.
Sourcepub fn validate_for_marginal_slope_typed(
&self,
) -> Result<(), LognormalKernelError>
pub fn validate_for_marginal_slope_typed( &self, ) -> Result<(), LognormalKernelError>
Typed variant of Self::validate_for_marginal_slope used internally;
the String-returning entry point above is preserved as a one-line
shim for external callers.
Trait Implementations§
Source§impl Clone for FrailtySpec
impl Clone for FrailtySpec
Source§fn clone(&self) -> FrailtySpec
fn clone(&self) -> FrailtySpec
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 FrailtySpec
impl Debug for FrailtySpec
Source§impl Default for FrailtySpec
impl Default for FrailtySpec
Source§fn default() -> FrailtySpec
fn default() -> FrailtySpec
Source§impl<'de> Deserialize<'de> for FrailtySpec
impl<'de> Deserialize<'de> for FrailtySpec
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>,
Source§impl PartialEq for FrailtySpec
impl PartialEq for FrailtySpec
Source§impl Serialize for FrailtySpec
impl Serialize for FrailtySpec
impl StructuralPartialEq for FrailtySpec
Auto Trait Implementations§
impl Freeze for FrailtySpec
impl RefUnwindSafe for FrailtySpec
impl Send for FrailtySpec
impl Sync for FrailtySpec
impl Unpin for FrailtySpec
impl UnsafeUnpin for FrailtySpec
impl UnwindSafe for FrailtySpec
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,
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.