AutoREG
AutoREG
- class AutoREG(lags=None, trend='c', seasonal=False, hold_back=None, period=None, missing='none', deterministic=None, cov_type='nonrobust', cov_kwds=None, use_t=True, dynamic=False)[source]
Autoregressive AR-X(p) model.
Estimate an AR-X model using Conditional Maximum Likelihood (OLS).
- Parameters:
- lags{None, int, list[int]}
The number of lags to include in the model if an integer or the list of lag indices to include. For example, [1, 4] will only include lags 1 and 4 while lags=4 will include lags 1, 2, 3, and 4. None excludes all AR lags, and behave identically to 0.
- trend{‘n’, ‘c’, ‘t’, ‘ct’}
The trend to include in the model:
‘n’ - No trend.
‘c’ - Constant only.
‘t’ - Time trend only.
‘ct’ - Constant and time trend.
- seasonalbool
Flag indicating whether to include seasonal dummies in the model. If seasonal is True and trend includes ‘c’, then the first period is excluded from the seasonal terms.
- hold_back{None, int}
Initial observations to exclude from the estimation sample. If None, then hold_back is equal to the maximum lag in the model. Set to a non-zero value to produce comparable models with different lag length. For example, to compare the fit of a model with lags=3 and lags=1, set hold_back=3 which ensures that both models are estimated using observations 3,…,nobs. hold_back must be >= the maximum lag in the model.
- period{None, int}
The period of the data. Only used if seasonal is True. This parameter can be omitted if using a pandas object that contains a recognized frequency.
- missingstr
Available options are ‘none’, ‘drop’, and ‘raise’. If ‘none’, no nan checking is done. If ‘drop’, any observations with nans are dropped. If ‘raise’, an error is raised. Default is ‘none’.
- deterministicDeterministicProcess
A deterministic process. If provided, trend and seasonal are ignored. A warning is raised if trend is not “n” and seasonal is not False.
- Attributes:
cutoffCut-off = “present time” state of forecaster.
fhForecasting horizon that was passed.
is_fittedWhether
fithas been called.stateState of the estimator.
Examples
Use AutoREG to forecast univariate data.
>>> from sktime.forecasting.auto_reg import AutoREG >>> from sktime.datasets import load_airline >>> from sktime.forecasting.base import ForecastingHorizon >>> data = load_airline() >>> autoreg_sktime = AutoREG(lags=2, trend="c") >>> autoreg_sktime.fit(y=data) AutoREG(lags=2) >>> fh = ForecastingHorizon([x for x in range(1, 13)]) >>> y_pred = autoreg_sktime.predict(fh=fh)
Use AutoREG to forecast with exogenous data.
>>> from sktime.forecasting.auto_reg import AutoREG >>> from sktime.datasets import load_longley >>> from sktime.forecasting.base import ForecastingHorizon >>> y, X_og = load_longley() >>> X_oos = X_og.iloc[-5:, :] >>> y, X = y.iloc[:-5], X_og.iloc[:-5, :] >>> X, X_oos = X[["GNPDEFL", "GNP"]], X_oos[["GNPDEFL", "GNP"]] >>> autoreg_sktime = AutoREG(lags=2, trend="c") >>> autoreg_sktime.fit(y=y, X=X) AutoREG(lags=2) >>> fh = ForecastingHorizon([x for x in range(1, 4)]) >>> y_pred = autoreg_sktime.predict(X=X_oos, fh=fh)
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.

