Why Short ARMA Simulations Can Produce Different Fitted Parameters
Summary
The document addresses why fitted AR parameters from a simulated ARMA series may differ substantially from the values used to generate it. The response says the simulation and fitting logic are sound and points to sampling variability: a series with only a few hundred observations may not estimate the generating coefficients precisely.
It recommends increasing the sample size and illustrates fitting the same ARMA order to a much longer simulated series, then reviewing coefficient estimates and diagnostic plots such as the autocorrelation and partial autocorrelation functions. This is an illustrative simulation example, not a guarantee that estimates will match exactly or a full treatment of model selection, specification errors, or finite-sample inference.
Key ideas
- Finite samples can produce fitted ARMA coefficients far from the generating parameters.
- Increasing the number of simulated observations can reduce estimation variability.
- Fit the intended ARMA order and inspect coefficient estimates alongside autocorrelation diagnostics.
- A larger simulated sample illustrates convergence but does not guarantee exact parameter recovery.
Tags
Full text
# Python regenerating ARMA params using statsmodels
# Python regenerating ARMA params using statsmodels
I am trying to regenerate the ARMA parameters from statsmodel in python. The code I am using is:
```
from statsmodels.tsa.arima_process import arma_generate_sample
import statsmodels.api as sm
arparams = np.array([.75, -.25])
maparams = np.array([.65, .35])
arparams = np.r_[1, -arparams]
maparam = np.r_[1, maparams]
nobs = 250
np.random.seed(2014)
y = arma_generate_sample(arparams, maparams, nobs) #generate ARMA series
res = sm.tsa.arma_order_select_ic(y, ic=['aic', 'bic'], trend='nc')
z = sm.tsa.ARMA(y, (2,2)).fit()
print z.arparams
array([ 0.13178508, 0.08568388])
```
The regenerated AR params are not same as the one I started with. What am I doing wrong?
## Answer by Elrond (score 4, accepted)
https://quant.stackexchange.com/a/41927
The logic of your code is all right. However, the variance of the parameters is high because `nobs=250` is relatively low. Increase `nobs` and your parameters will converge toward the parameters you specified eventually.
```
import statsmodels.api as sm
import numpy as np
# Parameters.
ar = np.array([.75, -.25])
ma = np.array([.65, .35])
# Simulate an ARMA process.
np.random.seed(42)
y = sm.tsa.arma_generate_sample(
ar=np.r_[1, -ar],
ma=np.r_[1, ma],
nsample=10000,
sigma=1,
)
# Fit ARMA process on the simulates to check coefficients, ACF and PACF.
model = sm.tsa.ARMA(y, (2, 2)).fit(trend='c')
# Plot ACF and PACF of estimated model.
sm.tsa.graphics.plot_acf(y, lags=20, zero=True);
sm.tsa.graphics.plot_pacf(y, lags=20, zero=True);
model.summary()
```
Reference: McKinney, W., Perktold, J., & Seabold, S. (2011)Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.