statsmodels.tsa.arima.model.ARIMA¶
-
class
statsmodels.tsa.arima.model.
ARIMA
(endog, exog=None, order=(0, 0, 0), seasonal_order=(0, 0, 0, 0), trend=None, enforce_stationarity=True, enforce_invertibility=True, concentrate_scale=False, trend_offset=1, dates=None, freq=None, missing='none')[source]¶ Autoregressive Integrated Moving Average (ARIMA) model, and extensions
This model is the basic interface for ARIMA-type models, including those with exogenous regressors and those with seasonal components. The most general form of the model is SARIMAX(p, d, q)x(P, D, Q, s). It also allows all specialized cases, including
autoregressive models: AR(p)
moving average models: MA(q)
mixed autoregressive moving average models: ARMA(p, q)
integration models: ARIMA(p, d, q)
seasonal models: SARIMA(P, D, Q, s)
regression with errors that follow one of the above ARIMA-type models
- Parameters
- endogarray_like,
optional
The observed time-series process \(y\).
- exogarray_like,
optional
Array of exogenous regressors.
- order
tuple
,optional
The (p,d,q) order of the model for the autoregressive, differences, and moving average components. d is always an integer, while p and q may either be integers or lists of integers.
- seasonal_order
tuple
,optional
The (P,D,Q,s) order of the seasonal component of the model for the AR parameters, differences, MA parameters, and periodicity. Default is (0, 0, 0, 0). D and s are always integers, while P and Q may either be integers or lists of positive integers.
- trend
str
{‘n’,’c’,’t’,’ct’}or
iterable,optional
Parameter controlling the deterministic trend. Can be specified as a string where ‘c’ indicates a constant term, ‘t’ indicates a linear trend in time, and ‘ct’ includes both. Can also be specified as an iterable defining a polynomial, as in numpy.poly1d, where [1,1,0,1] would denote \(a + bt + ct^3\). Default is ‘c’ for models without integration, and no trend for models with integration.
- enforce_stationaritybool,
optional
Whether or not to require the autoregressive parameters to correspond to a stationarity process.
- enforce_invertibilitybool,
optional
Whether or not to require the moving average parameters to correspond to an invertible process.
- concentrate_scalebool,
optional
Whether or not to concentrate the scale (variance of the error term) out of the likelihood. This reduces the number of parameters by one. This is only applicable when considering estimation by numerical maximum likelihood.
- trend_offset
int
,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, …, nobs. Typically is only set when the model created by extending a previous dataset.
- datesarray_like
of
datetime
,optional
If no index is given by endog or exog, an array-like object of datetime objects can be provided.
- freq
str
,optional
If no index is given by endog or exog, the frequency of the time-series may be specified here as a Pandas offset or offset string.
- missing
str
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’.
- endogarray_like,
Notes
This model incorporates both exogenous regressors and trend components through “regression with ARIMA errors”.
enforce_stationarity and enforce_invertibility are specified in the constructor because they affect loglikelihood computations, and so should not be changed on the fly. This is why they are not instead included as arguments to the fit method.
TODO: should we use concentrate_scale=True by default?
Examples
>>> mod = sm.tsa.arima.ARIMA(endog, order=(1, 0, 0)) >>> res = mod.fit() >>> print(res.summary())
Methods
clone
(endog[, exog])filter
(params[, transformed, …])Kalman filtering
fit
([start_params, transformed, …])Fit (estimate) the parameters of the model.
fit_constrained
(constraints[, start_params])Fit the model with some parameters subject to equality constraints.
fix_params
(params)Fix parameters to specific values (context manager)
from_formula
(formula, data[, subset])Not implemented for state space models
handle_params
(params[, transformed, …])hessian
(params, *args, **kwargs)Hessian matrix of the likelihood function, evaluated at the given parameters
impulse_responses
(params[, steps, impulse, …])Impulse response function
information
(params)Fisher information matrix of model.
Initialize the SARIMAX model.
initialize_approximate_diffuse
([variance])Initialize approximate diffuse
initialize_default
([…])Initialize default
initialize_known
(initial_state, …)Initialize known
initialize_statespace
(**kwargs)Initialize the state space representation
Initialize stationary
loglike
(params, *args, **kwargs)Loglikelihood evaluation
loglikeobs
(params[, transformed, …])Loglikelihood evaluation
observed_information_matrix
(params[, …])Observed information matrix
opg_information_matrix
(params[, …])Outer product of gradients information matrix
predict
(params[, exog])After a model has been fit predict returns the fitted values.
Prepare data for use in the state space representation
score
(params, *args, **kwargs)Compute the score function at params.
score_obs
(params[, method, transformed, …])Compute the score per observation, evaluated at params
set_conserve_memory
([conserve_memory])Set the memory conservation method
set_filter_method
([filter_method])Set the filtering method
set_inversion_method
([inversion_method])Set the inversion method
set_smoother_output
([smoother_output])Set the smoother output
set_stability_method
([stability_method])Set the numerical stability method
simulate
(params, nsimulations[, …])Simulate a new time series following the state space model
simulation_smoother
([simulation_output])Retrieve a simulation smoother for the state space model.
smooth
(params[, transformed, …])Kalman smoothing
transform_jacobian
(unconstrained[, …])Jacobian matrix for the parameter transformation function
transform_params
(unconstrained)Transform unconstrained parameters used by the optimizer to constrained parameters used in likelihood evaluation.
untransform_params
(constrained)Transform constrained parameters used in likelihood evaluation to unconstrained parameters used by the optimizer
update
(params[, transformed, …])Update the parameters of the model
Properties
Names of endogenous variables
The names of the exogenous variables.
Initial design matrix
Initial selection matrix
Initial state intercept vector
Initial transition matrix
The latex names of all possible model parameters.
The plain text names of all possible model parameters.
The orders of each of the polynomials in the model.
List of human readable parameter names (for parameters actually included in the model).
List of parameters actually included in the model, in sorted order.
Starting parameters for maximum likelihood estimation
(list of str) List of human readable names for unobserved states.