arimaFit function is a convenient tool for estimating the parameters of any ARIMA model, including:
- ARMA models.
- Purely AR models.
- Purely MA models.
It will compute parameter estimates and standard errors for a time series model with ARMA errors using exact maximum likelihood.
arimaFit for Matrix Inputs
Below are the inputs to
arimaFit when passing the time series as a GAUSS matrix:
- N x 1 vector, containing the time series.
- Scalar, the autoregressive order.
- Optional scalar, the order of differencing. Default = 0.
- Optional scalar, the moving average order. Default = 0.
- Optional control structure. Contains additional settings for the estimation, such as optimization tolerances, and starting values as well as control over printed output and more.
- The specified model must include sequential, ordered lags. For example, it will estimate the parameters for the first through fourth lag but will not estimate a model that includes ONLY the first and fourth lag.
- The time series data must be stationary and invertible.
Estimating ARIMA Models with Matrix Input
Example AR(2) Model
Let's consider estimating an AR(2) model using the same data from our previous tutorials. Assuming the data series,
y_sim, is still in memory we can estimate the AR(2) models with a single line of code:
call arimaFit(y_sim, 2);
The output printed to screen reads
Model: ARIMA(2,0,0) Final Results: Log Likelihood: 702.327968 Number of Residuals: 200
AIC : -1400.655937 Error Variance : 0.897749310
SBC : -1394.059302 Standard Error : 0.947496338
DF: 198 SSE: 177.754363357
Coefficients Std. Err. T-Ratio Approx. Prob. AR[1,1] 0.54960 0.02204 24.93987 0.00000
AR[2,1]-0.76906 0.03084 -24.93999 0.00000
Constant: 1.77120346 Total Computation Time: 0.83 (seconds) AR Roots and Moduli: Real : 0.35731 0.35731 Imag.: 1.08287 -1.08287 Mod. : 1.14030 1.14030
The estimated coefficients, 0.54960 and -0.76906, are reasonable estimates given the coefficients used to simulate the series
y_sim (0.5 and -0.8).
Example ARIMA(2,1,0) Model
Now, for the sake of demonstration, consider estimating an ARIMA(2,1,0) model. Because the order of differencing is now different from zero, both the AR order and the differencing must be specified as inputs to
arimaFit. However, because the MA order is still zero, it is not required:
call arimaFit(y_sim, 2, 1);
The output printed to screen reads
Model: ARIMA(2,1,0) Final Results: Log Likelihood: 746.618396 Number of Residuals: 199
AIC : -1489.236793 Error Variance : 1.458774290
SBC : -1482.650183 Standard Error : 1.207797289
DF: 197 SSE: 287.378535224
Coefficients Std. Err. T-Ratio Approx. Prob. AR[1,1] 0.27909 0.04745 5.88164 0.00000
AR[2,1]-0.74585 0.04729 -15.77057 0.00000
Constant: 0.01674604 Total Computation Time: 0.01 (seconds) AR Roots and Moduli: Real : 0.18710 0.18710 Imag.: 1.14270 -1.14270 Mod. : 1.15791 1.15791
Now, because of the improperly specified model, the coefficient estimates at 0.27909 and -0.74585 are no longer as accurate.
Example ARIMA(2,0,1) Model
Suppose that we now wish to estimate an ARIMA(2,0,1). In this model, the MA order differs from the default value of zero, but the differencing order is equal to the default value. However, because the optional arguments must be specified in the order p, d, q both the differencing order and MA order must be included as inputs:
call arimaFit(y_sim, 2, 0, 1);
The ARIMA(2,0,1) estimates printed to screen reads
Model: ARIMA(2,0,1) Final Results: Log Likelihood: 701.956107 Number of Residuals: 200
AIC : -1397.912214 Error Variance : 0.898957317
SBC : -1388.017262 Standard Error : 0.948133597
DF: 197 SSE: 177.094591531
Coefficients Std. Err. T-Ratio Approx. Prob. AR[1,1] 0.51708 0.05971 8.65960 0.00000
AR[2,1]-0.75937 0.04818 -15.76125 0.00000
MA[1,1]-0.07902 0.09151 -0.86349 0.38892
Constant: 1.80435249 Total Computation Time: 0.36 (seconds) AR Roots and Moduli: Real : 0.34047 0.34047 Imag.: 1.09589 -1.09589 Mod. : 1.14755 1.14755 MA Roots and Moduli: Real : -12.65461 Imag.: 0.00000 Mod. : 12.65461
The table now includes three estimates, two AR estimates and one MA estimate.
You have learned the basics of estimating ARIMA models with the
arimaFit function in GAUSS. The next tutorial in this series shows how to create and customize a time series plot.