pub fn fourier(
terms: &[(f64, usize)],
t0: u64,
rows: usize,
) -> Result<Vec<f64>, FourierError>Expand description
Fourier regressors for several seasonal periods, rows rows from time t0, row-major.
Each (period, k) of terms adds the fourier_columns of fourier_row, in order,
so daily, weekly and yearly patterns on hourly data are
&[(24.0, 10), (168.0, 5), (8766.0, 10)]. Pass the result to
Arima::fit_exog with columns the sum of the column counts,
and the rows from t0 = n on to the forecasts.
§Errors
FourierError::InvalidTerms if terms is empty or a pair of it is invalid (see
fourier_row).
§Panics
Panics if rows times the column count overflows usize, as an allocation that size would.
§Examples
use backshift::fourier;
let x = fourier(&[(7.0, 3), (4.0, 2)], 0, 10).unwrap();
assert_eq!(x.len(), 10 * (6 + 3)); // period 4 drops its Nyquist sine