# Tutorial #3: ARIMA models

```Tutorial #3: ARIMA models
*In using Stata 7.0 and Stata 8.0, some commands may differ. In the case that there is a
difference, it will be noted as V8, for version 8.0 commands and V7 for version 7.0 commands.
*To change from the Stata 8.0 to Stata 7.0, type “version 7.0” in the command line. Likewise, to
change back to Stata 8.0, type “version 8.0”
3.1 Estimating ARIMA models
First, look at the autocorrelation and partial autocorrelation for the construction variable for the
housing data.
. ac construction
. pac construction
It is clear that the data is not stationary.
To estimate the ARIMA model, try p=2, d=1, q=1*
. arima construction, arima(2,1,1) bfgs
Look at the autocorrelation and partial autocorrelation of the residuals
. ac e
. pac e
3.2
Running hypothesis test.
To run hypothesis tests on the arima model:
/*Compare the restricted and unrestricted model*/
V8
A likelihood ratio test
Estimate unrestricted model:
. arima construction, arima(2,1,1) bfgs
Save results from estimates:
. est store U
Estimate a restricted model:
. arima construction, arima(1,1,1)
Save results from estimates:
. est store R
Run likelihood tests comparing results:
. lrtest U R
V7
Likelihood ratio test:
Compare the restricted and unrestricted model
Estimate unrestricted model:
. arima construction, arima(2,1,1) bfgs
Save results from estimates:
. lrtest, saving(0)
Estimate a restricted model
. arima construction, arima(1,1,1) bfgs
Save results from estimates:
. lrtest, saving(1)
Run likelihood tests comparing results
. lrtest
------------------------------------------------------
To test that all coefficients are equal to zero using a Wald test.
. test[ARMA]
To test if coefficients are jointly equal to zero.
. test [ARMA]L.1.ar [ARMA]L.1.ma
A Lagrange multiplier test
. regress e L1.e L2.e
. global rs2=e(r2)
. global nobs=e(N)
. display _n(3) &quot;LM test statistic:&quot; _s(3) \$nobs*\$rs2 _s(3) chiprob(6,\$nobs*\$rs2)
```