Back to models
Forecaster

ARARForecaster

Categorical in XPred intPred int insample

ARAR (AutoRegressive-AutoRegressive) forecaster.

Quickstart

python
from sktime.forecasting.arar import ARARForecaster

estimator = ARARForecaster(max_ar_depth=None, max_lag=None, safe=True)

Parameters(3)

max_ar_depthint or None, default=None

Maximum AR lag to consider in subset selection. If None, defaults to:

  • 26 if n > 40

  • 13 if 13 <= n <= 40

  • max(4, ceil(n/3)) if n < 13

max_lagint or None, default=None

Maximum lag for computing autocovariances. If None, defaults to:

  • 40 if n > 40

  • 13 if 13 <= n <= 40

  • max(4, ceil(n/2)) if n < 13

safebool, default=True
Whether to use safe fitting mode. * If True, returns a simple mean-based fallback model when fitting fails. * If False, raises an exception on failure.

Examples

>>> from sktime.datasets import load_airline
>>> from sktime.forecasting.arar import ARARForecaster
>>> y = load_airline ()
>>> forecaster = ARARForecaster ()
>>> forecaster. fit (y) ARARForecaster(
... )
>>> y_pred = forecaster. predict (fh = [1, 2, 3 ]) Prediction intervals and coefficients:
>>> from sktime.split import temporal_train_test_split
>>> from sktime.utils.plotting import plot_series
>>> 
>>> # Load and split data
>>> y = load_airline()
>>> y_train, y_test = temporal_train_test_split(y, test_size=12)
>>> 
>>> # Fit and predict
>>> forecaster = ARARForecaster()
>>> forecaster.fit(y_train) ARARForecaster(…)
>>> y_pred = forecaster.predict(fh=list(range(1, 13)))
>>> pred_int = forecaster.predict_interval(fh=list(range(1, 13)))
>>> 
>>> # Plot results
>>> plot_series(… y_train, y_test, y_pred, labels=[“Train”, “Test”, “Forecast”], … title= “Forecast from Arar”, … pred_int=pred_int …) # doctest: +SKIP
>>> 
>>> # Print model information
>>> print(f”Selected AR lags: {forecaster.model_[2]}”) # doctest: +SKIP
>>> print(f”AR coefficients: {forecaster.model_[1]}”) # doctest: +SKIP
>>> print(f”Innovation variance: {forecaster.model_[3]:.4f}”) # doctest: +SKIP

References

  1. [1 ] Brockwell, Peter J, and Richard A. Davis. Introduction to Time Series and Forecasting (2016), Chapter 10.