ARARForecaster
ARARForecaster
- class ARARForecaster(max_ar_depth=None, max_lag=None, safe=True)[source]
ARAR (AutoRegressive-AutoRegressive) forecaster.
ARAR is a forecasting method that combines memory-shortening with subset autoregression. The method first applies a memory-shortening transformation to reduce long-term dependencies in the series, then fits a parsimonious autoregressive model using a subset of lags.
The algorithm proceeds in two stages:
Memory-shortening: Applies up to 3 rounds of filtering to reduce long-memory effects in the time series
Subset AR: Selects an optimal subset of 3 lags from the shortened series using a grid search over possible lag combinations
The ARAR model is a forecasting method designed for time series that may exhibit long-memory or persistent dependence. It works by automatically shortening the memory in the data and then fitting a small subset autoregressive (AR) model to the transformed series.
Mathematical details follow about the two main stages of the ARAR algorithm:
Stage 1: Memory Shortening (Adaptive AR Filter)
The algorithm tests for long-memory structure by examining delayed correlations.
If long memory is detected, it applies a simple AR filter at the best delay.
This step may repeat up to three times, composing a filter
\(\Psi(B) = 1 + \Psi_1 B + \cdots + \Psi_k B^k\)
until the transformed series behaves like a short-memory process.
Stage 2: Subset AR Modeling
After memory shortening, ARAR fits a 4-term subset AR model using Yule-Walker equations. It searches over candidate lag sets and selects the model with the smallest estimated noise variance. The resulting AR polynomial
\(\phi(B) = 1 - \phi_1 B - \phi_{l_1} B^{l_1} - \phi_{l_2} B^{l_2} - \phi_{l_3} B^{l_3}\) # noqa: E501
combines with the memory-shortening filter to produce the full ARAR kernel
\(\xi(B) = \Psi(B)\,\phi(B)\).
This approach allows ARAR to automatically adapt to persistent dynamics while remaining computationally efficient. It often performs well on seasonal or slowly decaying series where pure ARMA or exponential-smoothing models struggle.
- Parameters:
- 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.
- Attributes:
- model_tuple
Fitted ARAR model containing:
Y: original series
best_phi: AR coefficients for selected lags
best_lag: tuple of selected AR lags (1, i, j, k)
sigma2: innovation variance
psi: memory-shortening filter
sbar: mean of shortened series
max_ar_depth: effective max AR depth used
max_lag: effective max lag used
References
[1]Brockwell, Peter J, and Richard A. Davis.
Introduction to Time Series and Forecasting (2016), Chapter 10.
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
Methods
check_is_fitted([method_name])Check if the estimator has been fitted.
clone()Obtain a clone of the object with same hyper-parameters and config.
clone_tags(estimator[, tag_names])Clone tags from another object as dynamic override.
create_test_instance([parameter_set])Construct an instance of the class, using first test parameter set.
create_test_instances_and_names([parameter_set])Create list of all test instances and a list of names for them.
fit(y[, X, fh])Fit forecaster to training data.
fit_predict(y[, X, fh, X_pred])Fit and forecast time series at future horizon.
get_class_tag(tag_name[, tag_value_default])Get class tag value from class, with tag level inheritance from parents.
get_class_tags()Get class tags from class, with tag level inheritance from parent classes.
get_config()Get config flags for self.
get_fitted_params([deep])Get fitted parameters.
get_param_defaults()Get object's parameter defaults.
get_param_names([sort])Get object's parameter names.
get_params([deep])Get a dict of parameters values for this object.
get_pretrained_params([deep])Get pretrained parameters of this estimator.
get_tag(tag_name[, tag_value_default, ...])Get tag value from instance, with tag level inheritance and overrides.
get_tags()Get tags from instance, with tag level inheritance and overrides.
get_test_params([parameter_set])Return testing parameter settings for the estimator.
is_composite()Check if the object is composed of other BaseObjects.
load_from_path(serial)Load object from file location.
load_from_serial(serial)Load object from serialized memory container.
predict([fh, X])Forecast time series at future horizon.
predict_interval([fh, X, coverage])Compute/return prediction interval forecasts.
predict_proba([fh, X, marginal])Compute/return fully probabilistic forecasts.
predict_quantiles([fh, X, alpha])Compute/return quantile forecasts.
predict_residuals([y, X])Return residuals of time series forecasts.
predict_var([fh, X, cov])Compute/return variance forecasts.
pretrain(y[, X, fh])Pre-train forecaster on panel (global) data.
reset()Reset the object to a clean post-init state.
save([path, serialization_format])Save serialized self to bytes-like object or to (.zip) file.
score(y[, X, fh])Scores forecast against ground truth, using MAPE (non-symmetric).
set_config(**config_dict)Set config flags to given values.
set_params(**params)Set the parameters of this object.
set_random_state([random_state, deep, ...])Set random_state pseudo-random seed parameters for self.
set_tags(**tag_dict)Set instance level tag overrides to given values.
update(y[, X, update_params])Update cutoff value and, optionally, fitted parameters.
update_predict(y[, cv, X, update_params, ...])Make predictions and update model iteratively over the test set.
update_predict_single([y, fh, X, update_params])Update model with new data and make forecasts.

