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:
ararray_like

Coefficient for autoregressive lag polynomial, including zero lag. Must be entered using the signs from the lag polynomial representation. See the notes for more information about the sign.

maarray_like

Coefficient for moving-average lag polynomial, including zero lag.

nobsint, optional

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

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

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)\epsilon_{t}\]

Examples

ARMA(2,2) with AR coefficients 0.75 and -0.25, and MA coefficients 0.65 and 0.35

>>> import statsmodels.api as sm
>>> 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
>>> arma_process.arroots
array([1.5-1.32287566j, 1.5+1.32287566j])
>>> y = arma_process.generate_sample(250)
>>> model = sm.tsa.ARIMA(y, (2, 0, 2), trend='n').fit(disp=0)
>>> model.params
array([ 0.79044189, -0.23140636,  0.70072904,  0.40608028])

The same ARMA(2,2) Using the from_coeffs class method

>>> arma_process = sm.tsa.ArmaProcess.from_coeffs(arparams, maparams)
>>> arma_process.arroots
array([1.5-1.32287566j, 1.5+1.32287566j])

Methods

acf([lags])

Theoretical autocorrelation function of an ARMA process.

acovf([nobs])

Theoretical autocovariances of stationary ARMA processes

arma2ar([lags])

A finite-lag AR approximation of an ARMA process.

arma2ma([lags])

A finite-lag approximate MA representation of an ARMA process.

from_coeffs([arcoefs, macoefs, nobs])

Create ArmaProcess from an ARMA representation.

from_estimation(model_results[, nobs])

Create an ArmaProcess from the results of an ARIMA estimation.

from_roots([maroots, arroots, nobs])

Create ArmaProcess from AR and MA polynomial roots.

generate_sample([nsample, scale, distrvs, ...])

Simulate data from an ARMA.

impulse_response([leads])

Compute the impulse response function (MA representation) for ARMA process.

invertroots([retnew])

Make MA polynomial invertible by inverting roots inside unit circle.

pacf([lags])

Theoretical partial autocorrelation function of an ARMA process.

periodogram([nobs])

Periodogram for ARMA process given by lag-polynomials ar and ma.

Properties

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


Last update: Nov 14, 2024