Back to models
Forecaster

VARMAX

VARMAX forecasting model from statsmodels.

Quickstart

python
from sktime.forecasting.varmax import VARMAX

estimator = VARMAX(order=(1, 0), trend='c', error_cov_type='unstructured', measurement_error=False, enforce_stationarity=True, enforce_invertibility=True, trend_offset=1, start_params=None, transformed=True, includes_fixed=False, cov_type=None, cov_kwds=None, method='lbfgs', maxiter=50, full_output=1, disp=False, callback=None, return_params=False, optim_score=None, optim_complex_step=None, optim_hessian=None, flags=None, low_memory=False, dynamic=False, information_set='predicted', signal_only=False, suppress_warnings=False)

Parameters(26)

orderiterable
The (p,q) order of the model for the number of AR and MA parameters to use.
trendstr{‘n’,’c’,’t’,’ct’} or iterable, optional

Parameter controlling the deterministic trend polynomial \(A(t)\). Can be specified as a string where ‘c’ indicates a constant (i.e. a degree zero component of the trend polynomial), ‘t’ indicates a linear trend with time, and ‘ct’ is both. Can also be specified as an iterable defining the non-zero polynomial exponents to include, in increasing order. For example, [1,1,0,1] denotes \(a + bt + ct^3\). Default is a constant trend component.

error_cov_type{‘diagonal’, ‘unstructured’}, optional
The structure of the covariance matrix of the error term, where “unstructured” puts no restrictions on the matrix and “diagonal” requires it to be a diagonal matrix (uncorrelated errors). Default is “unstructured”.
measurement_errorbool, optional

Whether or not to assume the endogenous observations endog were measured with error. Default is False.

enforce_stationaritybool, optional
Whether or not to transform the AR parameters to enforce stationarity in the autoregressive component of the model. Default is True.
enforce_invertibilitybool, optional
Whether or not to transform the MA parameters to enforce invertibility in the moving average component of the model. Default is True.
trend_offsetint, optional

The offset at which to start time trend values. Default is 1, so that if trend='t' the trend is equal to 1, 2, …, n_obs. Typically is only set when the model created by extending a previous dataset.

start_paramsarray_like, optional
Initial guess of the solution for the loglikelihood maximization. If None, the default is given by Model.start_params.
transformedbool, optional
Whether or not start_params is already transformed. Default is True.
includes_fixedbool, optional
If parameters were previously fixed with the fix_params method, this argument describes whether or not start_params also includes the fixed parameters, in addition to the free parameters. Default is False.
cov_typestr, optional

The cov_type keyword governs the method for calculating the covariance matrix of parameter estimates. Can be one of:

  • ‘opg’ for the outer product of gradient estimator

  • ‘oim’ for the observed information matrix estimator, calculated

    using the method of Harvey (1989)

cov_kwdsdict or None, optional

A dictionary of arguments affecting covariance matrix computation. opg, oim, approx, robust, robust_approx

  • ‘approx_complex_step’bool, optional - If True, numerical

    approximations are computed using complex-step methods. If False, numerical approximations are computed using finite difference methods. Default is True.

methodstr, optional

The method determines which solver from scipy.optimize is used, and it can be chosen from among the following strings:

  • ‘newton’ for Newton-Raphson

  • ‘nm’ for Nelder-Mead

  • ‘bfgs’ for Broyden-Fletcher-Goldfarb-Shanno (BFGS)

  • ‘lbfgs’ for limited-memory BFGS with optional box constraints

  • ‘powell’ for modified Powell’s method

  • ‘cg’ for conjugate gradient

  • ‘ncg’ for Newton-conjugate gradient

  • ‘basinhopping’ for global basin-hopping solver

The explicit arguments in fit are passed to the solver, with the exception of the basin-hopping solver. Each solver has several optional arguments that are not the same across solvers. See the notes section below (or scipy.optimize) for the available arguments and for the list of explicit arguments that the basin-hopping solver supports.

maxiterint, optional
The maximum number of iterations to perform.
full_outputbool, optional
Set to True to have all available output in the Results object’s mle_retvals attribute. The output is dependent on the solver. See LikelihoodModelResults notes section for more information.
dispbool, optional
Set to True to print convergence messages.
callbackcallable callback(xk), optional
Called after each iteration, as callback(xk), where xk is the current parameter vector.
return_paramsbool, optional
Whether or not to return only the array of maximizing parameters. Default is False.
optim_score{‘harvey’, ‘approx’} or None, optional

The method by which the score vector is calculated. ‘harvey’ uses the method from Harvey (1989), ‘approx’ uses either finite difference or complex step differentiation depending upon the value of optim_complex_step, and None uses the built-in gradient approximation of the optimizer. Default is None. This keyword is only relevant if the optimization method uses the score.

optim_complex_stepbool, optional

Whether or not to use complex step differentiation when approximating the score; if False, finite difference approximation is used. Default is True. This keyword is only relevant if optim_score is set to ‘harvey’ or ‘approx’.

optim_hessian{‘opg’,’oim’,’approx’}, optional
The method by which the Hessian is numerically approximated. ‘opg’ uses outer product of gradients, ‘oim’ uses the information matrix formula from Harvey (1989), and ‘approx’ uses numerical approximation. This keyword is only relevant if the optimization method uses the Hessian matrix.
low_memorybool, optional
If set to True, techniques are applied to substantially reduce memory usage. If used, some features of the results object will not be available (including smoothed results and in-sample prediction), although out-of-sample forecasting is possible. Default is False.
dynamicbool, int, str, or datetime, optional

Integer offset relative to start at which to begin dynamic prediction. Can also be an absolute date string to parse or a datetime type (these are not interpreted as offsets). Prior to this observation, true endogenous values will be used for prediction; starting with this observation and continuing through the end of prediction, forecasted endogenous values will be used instead.

information_setstr, optional

The information set to condition each prediction on. Default is “predicted”, which computes predictions of period t values conditional on observed data through period t-1; these are one-step-ahead predictions, and correspond with the typical fittedvalues results attribute. Alternatives are “filtered”, which computes predictions of period t values conditional on observed data through period t, and “smoothed”, which computes predictions of period t values conditional on the entire dataset (including also future observations t+1, t+2, …).

signal_onlybool, optional
Whether to compute predictions of only the “signal” component of the observation equation. Default is False. For example, the observation equation of a time-invariant model is \(y_t = d + Z \alpha_t + \varepsilon_t\), and the “signal” component is then \(Z \alpha_t\). If this argument is set to True, then predictions of the “signal” \(Z \alpha_t\) will be returned. Otherwise, the default is for predictions of \(y_t\) to be returned.
suppress_warningsbool, optional

Many warnings might be thrown inside of statsmodels. If suppress_warnings is True, all of these warnings will be squelched. Default is False.

Examples

>>> from sktime.forecasting.varmax import VARMAX
>>> from sktime.datasets import load_macroeconomic
>>> from sktime.split import temporal_train_test_split
>>> y = load_macroeconomic ()
>>> forecaster = VARMAX (suppress_warnings = True)
>>> forecaster. fit (y [['realgdp', 'unemp' ]]) VARMAX(
... )
>>> y_pred = forecaster. predict (fh = [1, 4, 12 ])

References

  1. [1 ] (1, 2) Lütkepohl, Helmut. 2007. New Introduction to Multiple Time Series Analysis. Berlin: Springer.