The AUTOREG Procedure |
In this example, a pure autoregressive error model with no regressors is used to generate 50 values of a time series. Approximately 15% of the values are randomly chosen and set to missing. The following statements generate the data:
title 'Simulated Time Series with Roots:'; title2 ' (X-1.25)(X**4-1.25)'; title3 'With 15% Missing Values'; data ar; do i=1 to 550; e = rannor(12345); n = sum( e, .8*n1, .8*n4, -.64*n5 ); /* ar process */ y = n; if ranuni(12345) > .85 then y = .; /* 15% missing */ n5=n4; n4=n3; n3=n2; n2=n1; n1=n; /* set lags */ if i>500 then output; end; run;
The model is estimated using maximum likelihood, and the residuals are plotted with 99% confidence limits. The PARTIAL option prints the partial autocorrelations. The following statements fit the model:
proc autoreg data=ar partial; model y = / nlag=(1 4 5) method=ml; output out=a predicted=p residual=r ucl=u lcl=l alphacli=.01; run;
The printed output produced by the AUTOREG procedure is shown in Output 8.4.1 and Output 8.4.2. Note: the plot Output 8.4.2 can be viewed in the Autoreg.Model.FitDiagnosticPlots category by selecting ViewResults.
Dependent Variable | y |
---|
Ordinary Least Squares Estimates | |||
---|---|---|---|
SSE | 182.972379 | DFE | 40 |
MSE | 4.57431 | Root MSE | 2.13876 |
SBC | 181.39282 | AIC | 179.679248 |
MAE | 1.80469152 | AICC | 179.781813 |
MAPE | 270.104379 | HQC | 180.303237 |
Durbin-Watson | 1.3962 | Regress R-Square | 0.0000 |
Total R-Square | 0.0000 |
Parameter Estimates | |||||
---|---|---|---|---|---|
Variable | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
Intercept | 1 | -2.2387 | 0.3340 | -6.70 | <.0001 |
Estimates of Autoregressive Parameters | |||
---|---|---|---|
Lag | Coefficient | Standard Error | t Value |
1 | -0.733182 | 0.089966 | -8.15 |
4 | -0.803754 | 0.071849 | -11.19 |
5 | 0.821179 | 0.093818 | 8.75 |
The following statements plot the residuals and confidence limits:
data reshape1; set a; miss = .; if r=. then do; miss = p; p = .; end; run; title 'Predicted Values and Confidence Limits'; proc sgplot data=reshape1 NOAUTOLEGEND; band x=i upper=u lower=l; scatter y=miss x=i/ MARKERATTRS =(symbol=x color=red); series y=p x=i/markers MARKERATTRS =(color=blue) lineattrs=(color=blue); run;
The plot of the predicted values and the upper and lower confidence limits is shown in Output 8.4.3. Note that the confidence interval is wider at the beginning of the series (when there are no past noise values to use in the forecast equation) and after missing values where, again, there is an incomplete set of past residuals.
Copyright © SAS Institute, Inc. All Rights Reserved.