statsmodels.tsa.arima_process.ArmaProcess

class statsmodels.tsa.arima_process.ArmaProcess(ar=None, ma=None, nobs=100)[source]

Theoretical properties of an ARMA process for specified lag-polynomials

Parameters:

ar : array_like, 1d, optional

Coefficient for autoregressive lag polynomial, including zero lag. See the notes for some information about the sign.

ma : array_like, 1d, optional

Coefficient for moving-average lag polynomial, including zero lag

nobs : int, optional

Length of simulated time series. Used, for example, if a sample is generated. See example.

Notes

Both the AR and MA components must include the coefficient on the zero-lag. In almost all cases these values should be 1. Further, due to using the lag-polynomial representation, the AR parameters should have the opposite sign of what one would write in the ARMA representation. See the examples below.

The ARMA(p,q) process is described by

\[y_{t}=\phi_{1}y_{t-1}+\ldots+\phi_{p}y_{t-p}+\theta_{1}\epsilon_{t-1} +\ldots+\theta_{q}\epsilon_{t-q}+\epsilon_{t}\]

and the parameterization used in this function uses the lag-polynomial representation,

\[\left(1-\phi_{1}L-\ldots-\phi_{p}L^{p}\right)y_{t} = \left(1-\theta_{1}L-\ldots-\theta_{q}L^{q}\right)\]

Examples

>>> import numpy as np
>>> np.random.seed(12345)
>>> arparams = np.array([.75, -.25])
>>> maparams = np.array([.65, .35])
>>> ar = np.r_[1, -arparams] # add zero-lag and negate
>>> ma = np.r_[1, maparams] # add zero-lag
>>> arma_process = sm.tsa.ArmaProcess(ar, ma)
>>> arma_process.isstationary
True
>>> arma_process.isinvertible
True
>>> y = arma_process.generate_sample(250)
>>> model = sm.tsa.ARMA(y, (2, 2)).fit(trend='nc', disp=0)
>>> model.params
array([ 0.79044189, -0.23140636,  0.70072904,  0.40608028])

Attributes

arroots Roots of autoregressive lag-polynomial
isinvertible Arma process is invertible if MA roots are outside unit circle
isstationary Arma process is stationary if AR roots are outside unit circle
maroots Roots of moving average lag-polynomial

Methods

acf([lags]) Theoretical autocorrelation function of an ARMA process
acovf([nobs]) Theoretical autocovariance function of ARMA process
arma2ar([lags]) Get the AR representation of an ARMA process
arma2ma([lags]) Get the MA representation of an ARMA process
from_coeffs([arcoefs, macoefs, nobs]) Convenience function to create ArmaProcess from ARMA representation
from_estimation(model_results[, nobs]) Convenience function to create an ArmaProcess from the results of an ARMA estimation
generate_sample([nsample, scale, distrvs, …]) Simulate an ARMA
impulse_response([leads]) Get the impulse response function (MA representation) for ARMA process
invertroots([retnew]) Make MA polynomial invertible by inverting roots inside unit circle
pacf([lags]) Partial autocorrelation function of an ARMA process
periodogram([nobs]) Periodogram for ARMA process given by lag-polynomials ar and ma