Aptech Store

Estimating ARIMA Models

Introduction

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


y
N x 1 vector, containing the time series.
p
Scalar, the autoregressive order.
d
Optional scalar, the order of differencing. Default = 0.
q
Optional scalar, the moving average order. Default = 0.
ctl
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.

Estimation Requirements

  • 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)          Dependent variable:           Y_ar2
Time Span:                  Unknown          Valid cases:                    200
SSE:                        177.754          Degrees of freedom:             198
Log Likelihood:             702.328          RMSE:                         0.943
AIC:                        702.328          SEE:                          0.947
SBC:                      -1394.059          Durbin-Watson:                1.909
R-squared:                    0.630          Rbar-squared:                 0.626
================================================================================
Coefficient                Estimate      Std. Err.        T-Ratio     Prob |>| t
================================================================================

AR[1,1]                       0.549          0.045         12.101          0.000
AR[2,1]                      -0.770          0.045        -17.015          0.000
Constant                      1.773          0.951          1.864          0.064
================================================================================

Total Computation Time: 0.04 (seconds)

MA Roots and Moduli:
---------------------------------------------

         Real :        0.35674        0.35674
        Imag. :        1.08266       -1.08266
         Mod. :        1.13992        1.13992 

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)          Dependent variable:           Y_ar2
Time Span:                  Unknown          Valid cases:                    199
SSE:                        287.379          Degrees of freedom:             197
Log Likelihood:             746.618          RMSE:                         1.202
AIC:                        746.618          SEE:                          1.208
SBC:                      -1482.650          Durbin-Watson:                2.595
R-squared:                    0.565          Rbar-squared:                 0.561
================================================================================
Coefficient                Estimate      Std. Err.        T-Ratio     Prob |>| t
================================================================================

AR[1,1]                       0.279          0.047          5.882          0.000
AR[2,1]                      -0.746          0.047        -15.771          0.000
Constant                      0.017          1.214          0.014          0.989
================================================================================

Total Computation Time: 0.01 (seconds)

MA 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)          Dependent variable:           Y_ar2
Time Span:                  Unknown          Valid cases:                    200
SSE:                        177.095          Degrees of freedom:             197
Log Likelihood:             701.956          RMSE:                         0.941
AIC:                        701.956          SEE:                          0.948
SBC:                      -1388.017          Durbin-Watson:                2.002
R-squared:                    0.631          Rbar-squared:                 0.625
================================================================================
Coefficient                Estimate      Std. Err.        T-Ratio     Prob |>| t
================================================================================

AR[1,1]                       0.517          0.060          8.665          0.000
AR[2,1]                      -0.759          0.048        -15.764          0.000
MA[1,1]                      -0.079          0.091         -0.865          0.388
Constant                      1.804          0.952          1.896          0.059
================================================================================

Total Computation Time: 0.08 (seconds)

MA Roots and Moduli:
---------------------------------------------

         Real :        0.34047        0.34047
        Imag. :        1.09589       -1.09589
         Mod. :        1.14755        1.14755
MA Roots and Moduli:
------------------------------

         Real :      -12.65466
        Imag. :        0.00000
         Mod. :       12.65466 

The table now includes three estimates, two AR estimates and one MA estimate.

Conclusion

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.

For your convenience, the entire code is available here.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.