添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
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' , validate_specification = True ) [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 :
    endog array_like

    The observed time-series process \(y\) .

    exog array_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 specifying exactly which lag orders are included. The order of differences is to achieve stationnarity in the context of a sochastic trend or seasonality. The default is (0, 0, 0).

    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. D is a non- negative integer, and s is an integer strictly greater than one. P and Q may either be integers or lists of positive integers specifying exactly which lag orders are included. The default is (0, 0, 0, 0).

    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. Note that all trend terms are included in the model as exogenous regressors, which differs from how trends are included in SARIMAX models. See the Notes section for a precise definition of the treatment of trend terms.

    enforce_stationarity bool , optional

    Whether or not to require the autoregressive parameters to correspond to a stationarity process. Default is True.

    enforce_invertibility bool , optional

    Whether or not to require the moving average parameters to correspond to an invertible process. Default is True.

    concentrate_scale bool , 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. Default is False.

    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.

    dates array_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 , optional

    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’.

    Attributes :
    endog_names

    Names of endogenous variables

    exog_names

    The names of the exogenous variables.

    initial_design

    Initial design matrix

    initial_selection

    Initial selection matrix

    initial_state_intercept

    Initial state intercept vector

    initial_transition

    Initial transition matrix

    initial_variance
    initialization
    loglikelihood_burn
    model_latex_names

    The latex names of all possible model parameters.

    model_names

    The plain text names of all possible model parameters.

    model_orders

    The orders of each of the polynomials in the model.

    param_names

    List of human readable parameter names (for parameters actually included in the model).

    param_terms

    List of parameters actually included in the model, in sorted order.

    start_params

    Starting parameters for maximum likelihood estimation

    state_names

    (list of str) List of human readable names for unobserved states.

    tolerance

    Notes

    This model incorporates both exogenous regressors and trend components through “regression with ARIMA errors”. This differs from the specification estimated using SARIMAX which treats the trend components separately from any included exogenous regressors. The full specification of the model estimated here is:

    \[\begin{split}Y_{t}-\delta_{0}-\delta_{1}t-\ldots-\delta_{k}t^{k}-X_{t}\beta & =\epsilon_{t} \\ \left(1-L\right)^{d}\left(1-L^{s}\right)^{D}\Phi\left(L\right) \Phi_{s}\left(L\right)\epsilon_{t} & =\Theta\left(L\right)\Theta_{s}\left(L\right)\eta_{t}\end{split}\]

    where \(\eta_t \sim WN(0,\sigma^2)\) is a white noise process, L is the lag operator, and \(G(L)\) are lag polynomials corresponding to the autoregressive ( \(\Phi\) ), seasonal autoregressive ( \(\Phi_s\) ), moving average ( \(\Theta\) ), and seasonal moving average components ( \(\Theta_s\) ).

    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.

    See the notebook ARMA: Sunspots Data and ARMA: Artificial Data for an overview.

    Examples

    >>> mod = sm.tsa.arima.ARIMA(endog, order=(1, 0, 0))
    >>> res = mod.fit()
    >>> print(res.summary())
    

    Methods

    clone(endog[, exog])

    Clone state space model with new data and optionally new specification

    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, ...])

    Ensure model parameters satisfy shape and other requirements

    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()

    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()

    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()

    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

    endog_names

    Names of endogenous variables

    exog_names

    The names of the exogenous variables.

    initial_design

    Initial design matrix

    initial_selection

    Initial selection matrix

    initial_state_intercept

    Initial state intercept vector

    initial_transition

    Initial transition matrix

    initial_variance

    initialization

    loglikelihood_burn

    model_latex_names

    The latex names of all possible model parameters.

    model_names

    The plain text names of all possible model parameters.

    model_orders

    The orders of each of the polynomials in the model.

    param_names

    List of human readable parameter names (for parameters actually included in the model).

    param_terms

    List of parameters actually included in the model, in sorted order.

    params_complete

    start_params

    Starting parameters for maximum likelihood estimation

    state_names

    (list of str) List of human readable names for unobserved states.

    tolerance