pub struct Garch;Expand description
GARCH(1,1) to fit to a zero-mean series.
§Examples
use backshift::{Garch, GarchFilter};
let x: Vec<f64> = (0..300).map(|t| ((t * 37 % 101) as f64 - 50.0) / 25.0).collect();
let fit = Garch::new().fit(&x).unwrap();
assert!(fit.alpha + fit.beta < 1.0);
let filter = GarchFilter::new(&fit.spec()).unwrap();
let mut variance = [0.0; 5];
filter.forecast_into(&mut variance);
assert!(variance.iter().all(|v| *v > 0.0));Implementations§
Source§impl Garch
impl Garch
Sourcepub const fn new() -> Self
pub const fn new() -> Self
GARCH(1,1) without a mean: fit it to returns, or to the innovations of a fitted ARIMA or ETS model.
Sourcepub fn fit(&self, x: &[f64]) -> Result<GarchFit, FitError>
pub fn fit(&self, x: &[f64]) -> Result<GarchFit, FitError>
Fits the model to x by maximum likelihood.
§Errors
FitError::Unsupportedif a value is not finite.FitError::TooShortfor fewer than 10 values.FitError::Degenerateif the values are all 0, or no start can be scored.
Trait Implementations§
impl Copy for Garch
impl Eq for Garch
impl StructuralPartialEq for Garch
Auto Trait Implementations§
impl Forget for Garch
impl Freeze for Garch
impl Move for Garch
impl RefUnwindSafe for Garch
impl Send for Garch
impl Sync for Garch
impl Unpin for Garch
impl UnsafeUnpin for Garch
impl UnwindSafe for Garch
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