Struct ScaledSurvival
pub struct ScaledSurvival {
base: Box<Survival>,
pillars: Vec<NaiveDate>,
factors: Vec<f64>,
breaks: Vec<NaiveDate>,
}Expand description
A base credit curve whose hazard is multiplied by a piecewise-constant
term structure: β_k on the segment ending at the k-th scaling pillar
(right-closed, as the ISDA family’s segments are), the last β past it.
ln S'(t) = Σ_k β_k·(ln S(t∧p_k) − ln S(t∧p_{k−1})), exact on any base.
It is how an index’s skew adjustment moves every constituent in
proportion to its own hazard. The factors are stated data, as a shock’s
shift is: a risk pass reads the base’s parameters and holds the skew.
Fields§
§base: Box<Survival>§pillars: Vec<NaiveDate>§factors: Vec<f64>§breaks: Vec<NaiveDate>The base’s pillars and the scaling pillars merged: every date the scaled hazard can change on.
Implementations§
§impl ScaledSurvival
impl ScaledSurvival
pub fn new(
base: Survival,
segments: &[(NaiveDate, f64)],
) -> Result<Self, CurveError>
pub fn new( base: Survival, segments: &[(NaiveDate, f64)], ) -> Result<Self, CurveError>
base with its hazard scaled by factors[k] up to pillars[k].
§Errors
CurveError::Malformed if there are no factors, the two lists differ
in length, the pillars do not strictly increase from the base’s
reference date, or a factor is not finite and non-negative.
pub fn pillar_dates(&self) -> &[NaiveDate]
pub fn pillar_dates(&self) -> &[NaiveDate]
Every date the scaled hazard can change on.
pub fn view<R: Scalar>(&self) -> ScaledSurvivalView<'_, R>
pub fn view<R: Scalar>(&self) -> ScaledSurvivalView<'_, R>
This transform lifted into mode R.
pub(crate) fn view_with_slice<'a, R: Scalar>(
&'a self,
rest: &mut &'a [R],
) -> ScaledSurvivalView<'a, R>
pub(crate) fn view_with_slice<'a, R: Scalar>( &'a self, rest: &mut &'a [R], ) -> ScaledSurvivalView<'a, R>
One step of a substituted walk; reaches the base only.
pub(crate) fn view_seeding<R: Scalar + Seedable>(
&self,
seed: &mut Option<usize>,
) -> ScaledSurvivalView<'_, R>
pub(crate) fn view_seeding<R: Scalar + Seedable>( &self, seed: &mut Option<usize>, ) -> ScaledSurvivalView<'_, R>
One step of the seeded walk; the seed reaches the base only.
Trait Implementations§
§impl Clone for ScaledSurvival
impl Clone for ScaledSurvival
§fn clone(&self) -> ScaledSurvival
fn clone(&self) -> ScaledSurvival
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more