BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
MMarion
Calcite | Level 5

Hello,

I am working with Bowerman textbook Forecasting, Time Series, and Regression -4th edition. He presents many good examples but does not include all SAS code. My question has to do with proc arima and the SAS output from Bowerman. I am not getting the ACF and PACF plots of the residuals to match. This is a two-fold problem in that SAS has changed with ods graphics and my code does not produce matching covariance and correlation values for the residuals. I would like the acf and pacf covariances and correlations to be stored so I can retrieve their values.

 

My SAS code is included below:

ods graphics on;
proc arima data=ultraShine plots(unpack)=series(acf pacf);
identify var=y(1);
estimate p=1 method=CLS maxit=4 printall;
outlier;
forecast lead=10 out=forecasts;
run;

 

The source code, data and Bowerman results are given in the enclosed files.

I am using sas studio -demand edition. Can you help?

Thank you.

MM

1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

Hello,

 

Sorry, 

the autocovariances, autocorrelations, inverse autocorrelations, partial autocorrelations, and cross covariances are indeed in the "OUTCOV=SAS-data-set" output data set.

But these are the autocovariances, autocorrelations, inverse autocorrelations, partial autocorrelations, and cross covariances of the time series variable in the IDENTIFY statement, not those of the residuals!

 

The output data set produced by the OUT= option of the PROC ARIMA or FORECAST statements contains the RESIDUALs (a numeric variable that contains the differences between actual and forecast values).

Submit a new PROC ARIMA on the RESIDUALs to get what you want.

 

Cheers,

Koen

View solution in original post

6 REPLIES 6
sbxkoenk
SAS Super FREQ

Use ODS OUTPUT statement !

ods graphics on;
ods trace on;
ods output SeriesACFPlot  = work.SeriesACFPlot
           SeriesPACFPlot = work.SeriesPACFPlot ;

proc arima data=sashelp.citimon plots(unpack)=series(acf pacf);
identify var=CCIUTC(1);
estimate p=1 method=CLS maxit=4 printall;
outlier;
forecast lead=10 out=forecasts;
run;
QUIT;

See also :

Using PROC ARIMA to Model Trends in US Home Prices
https://communities.sas.com/t5/SAS-Communities-Library/Using-PROC-ARIMA-to-Model-Trends-in-US-Home-P...

 

Koen

MMarion
Calcite | Level 5
Thank you for your reply. The following code is not giving me the correct list of ACF and PACF values. Are they not in outcov = mycorr? Something is still incorrect.
proc arima data=ultraShine plots(unpack)=series(acf pacf corr);
identify var=y(1) nlag=88 outcov=mycorr;
estimate p=1 method=CLS printall;
run; quit; title;
MMarion
Calcite | Level 5
It is the ACF and PACF of the residuals that I want output. I am not sure where they are or whether I need say more about outcov.
sbxkoenk
SAS Super FREQ

Hello,

 

Sorry, 

the autocovariances, autocorrelations, inverse autocorrelations, partial autocorrelations, and cross covariances are indeed in the "OUTCOV=SAS-data-set" output data set.

But these are the autocovariances, autocorrelations, inverse autocorrelations, partial autocorrelations, and cross covariances of the time series variable in the IDENTIFY statement, not those of the residuals!

 

The output data set produced by the OUT= option of the PROC ARIMA or FORECAST statements contains the RESIDUALs (a numeric variable that contains the differences between actual and forecast values).

Submit a new PROC ARIMA on the RESIDUALs to get what you want.

 

Cheers,

Koen

MMarion
Calcite | Level 5

Here is what I came up with. I can get the residual acf and pacf in first run of proc arima but I don't know how to output table ChiSqAuto. It is not working for me. Perhaps it is the ods exclude statement?

 

ods exclude optSummary IACFgraph SeriesIACFplot ResidualIACFPLot;
proc arima data=ultraShine plots(unpack)=series(acf pacf corr)
plots=residual(acf pacf);
identify var=y(1) nlag=88 outcov=mycorr;
estimate p=1 method=CLS printall;
outlier;
forecast lead=10 out=forecasts;
run; quit; title;

ods graphics off;
ods exclude IACFgraph;
proc arima data=forecasts plots(unpack)=series(acf pacf corr);
identify var=residual nlag=24 outcov=mycorr_residual;
run; quit; title;

 Now I am following textbook output. Thanks for stepping in.  MM

sbxkoenk
SAS Super FREQ

Hello,

 

For ChiSqAuto in a table, you need an

ODS OUTPUT

statement.

 

SAS® 9.4 and SAS® Viya® 3.5 Programming Documentation | SAS 9.4 / Viya 3.5
SAS/ETS User's Guide
The ARIMA Procedure
ODS Table Names

https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/etsug/etsug_arima_details53.htm

 

Koen

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 422 views
  • 0 likes
  • 2 in conversation