pub struct StructuralTimeSeries;Expand description
Structural Time Series builder and fitter.
Implementations§
Source§impl StructuralTimeSeries
impl StructuralTimeSeries
Sourcepub fn fit_local_level(
y: &[f64],
level_var: f64,
obs_var: f64,
init_level: Option<f64>,
init_var: Option<f64>,
) -> StatsResult<StsFitResult>
pub fn fit_local_level( y: &[f64], level_var: f64, obs_var: f64, init_level: Option<f64>, init_var: Option<f64>, ) -> StatsResult<StsFitResult>
Fit a local level model to a univariate time series.
The local level model is:
y_t = μ_t + ε_t, ε_t ~ N(0, σ²_ε)
μ_{t+1} = μ_t + η_t, η_t ~ N(0, σ²_η)State x_t = [μ_t].
§Arguments
y– univariate time series (length T).level_var– process noise variance σ²_η (must be > 0).obs_var– observation noise variance σ²_ε (must be > 0).init_level– initial level estimate (defaults toy[0]).init_var– initial state variance (defaults to 1e6 for diffuse init).
Sourcepub fn fit_local_linear_trend(
y: &[f64],
level_var: f64,
slope_var: f64,
obs_var: f64,
init_level: Option<f64>,
init_slope: Option<f64>,
init_var: Option<f64>,
) -> StatsResult<StsFitResult>
pub fn fit_local_linear_trend( y: &[f64], level_var: f64, slope_var: f64, obs_var: f64, init_level: Option<f64>, init_slope: Option<f64>, init_var: Option<f64>, ) -> StatsResult<StsFitResult>
Fit a local linear trend model to a univariate time series.
The local linear trend model is:
y_t = μ_t + ε_t, ε_t ~ N(0, σ²_ε)
μ_{t+1} = μ_t + ν_t + η_t, η_t ~ N(0, σ²_η)
ν_{t+1} = ν_t + ζ_t, ζ_t ~ N(0, σ²_ζ)State x_t = [μ_t, ν_t].
§Arguments
y– univariate time series.level_var– level innovation variance σ²_η.slope_var– slope innovation variance σ²_ζ.obs_var– observation noise variance σ²_ε.init_level– initial level (defaults toy[0]).init_slope– initial slope (defaults to 0).init_var– initial state variance (defaults to 1e6).
Auto Trait Implementations§
impl Freeze for StructuralTimeSeries
impl RefUnwindSafe for StructuralTimeSeries
impl Send for StructuralTimeSeries
impl Sync for StructuralTimeSeries
impl Unpin for StructuralTimeSeries
impl UnsafeUnpin for StructuralTimeSeries
impl UnwindSafe for StructuralTimeSeries
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.