Enum FittedForm
#[non_exhaustive]pub enum FittedForm {
NelsonSiegel,
Svensson,
ExponentialSplines {
basis: usize,
},
}Expand description
Which functional shape a fit reaches for.
The three differ in what they can express and in what they cost: four parameters, six, or a basis the caller sizes. They are separate members of the curve set rather than one wrapper, so a risk row naming a parameter can say which form it belongs to.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NelsonSiegel
Level, slope and one hump. Four parameters.
Svensson
Nelson-Siegel with a second hump. Six parameters, and it nests the four-parameter form.
ExponentialSplines
A normalised basis of basis decaying exponentials, basis + 1
parameters. The only form here whose fit must be checked for validity
before it is returned.
Implementations§
§impl FittedForm
impl FittedForm
fn start(
self,
reference: NaiveDate,
mean_yield: f64,
) -> Result<Curve, CurveError>
fn start( self, reference: NaiveDate, mean_yield: f64, ) -> Result<Curve, CurveError>
A starting shape: the level at mean_yield, no slope or hump, and a
decay in the middle of a government curve’s range.
§Errors
CurveError if the start is not a well-formed curve.
fn rebuild(
self,
reference: NaiveDate,
params: &[f64],
) -> Result<Curve, CurveError>
fn rebuild( self, reference: NaiveDate, params: &[f64], ) -> Result<Curve, CurveError>
This form rebuilt at reference with params written into it verbatim.
The stored vector is the fit’s own — decays included, in whatever unconstrained form the family keeps them — so nothing round-trips through a natural value on the way back.
Trait Implementations§
§impl Clone for FittedForm
impl Clone for FittedForm
§fn clone(&self) -> FittedForm
fn clone(&self) -> FittedForm
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more