pub fn fit<T: Float + From<u32> + From<f64> + Into<f64> + Copy + Add + AddAssign + Div + Debug>(
x: &[T],
ar: usize,
d: usize,
ma: usize
) -> Result<Vec<f64>>
Expand description
Fit an ARIMA model. Returns the fitted coefficients. This method uses the L-BFGS algorithm and the conditional sum of squares (CSS) as the objective function.
Arguments
&x
- Vector of the timeseries.ar
- Order of the AR coefficients.d
- Order of differencing.ma
- Order of the MA coefficients.
Returns
- ARIMA coefficients minimizing the conditional sum of squares (CSS).
Example
use arima::estimate;
let x = [1.0, 1.2, 1.4, 1.6, 1.4, 1.2, 1.0];
let coef = estimate::fit(&x, 0, 0, 1).unwrap();
assert!((coef[0] - 1.2051).abs() < 1.0e-3); // intercept
assert!((coef[1] - 0.5637).abs() < 1.0e-3); // phi_1