Dear SAS Community,
I would like to ask for your advice on how to perform a formal test for constant variance (homoscedasticity) in the innovation series when using the proc arima procedure.
For example, the code below runs SARIMA (0,1,1)x(0,1,1)_12 model and generates a residual plot, which can visually help in identifying variance changes:
proc arima data=a
plots(only)=(residual(smooth));
identify var=Zt(1,12);
estimate p=(0)(0) q=(1)(12) method=ml noconstant;
run;
However, I was wondering if it is possible to conduct a formal test to determine whether the residuals of a fitted model are homoscedastic.
I’ve heard about a series of tests developed by McLeod and his co-authors, but I’m not sure how to implement such (or any relevant) tests in SAS.
I would greatly appreciate your guidance on this topic.
This page contains all the info to interpret the output of ARCHTEST option in PROC AUTOREG!
SAS Help Center: Testing for Heteroscedasticity
Note that you can ask for different flavours of this ARCHTEST option.
I tested ARCHTEST option myself with seriesg (series-G).
Here's more info on Box and Jenkins Series-G (International Airline Passengers)
SAS Help Center: Seasonal Model for the Airline Series
/*-- Seasonal Model for the Airline Series --*/
data seriesg;
set sashelp.air;
xlog = log( air );
run;
proc arima data=seriesg;
identify var=xlog(1,12);
estimate q=(1)(12) noint method=ml;
forecast id=date lead=0 interval=month printall out=b;
run;
QUIT;
data c;
set b;
where residual is not missing;
Time + 1;
run;
/* Test for heteroscedastic residuals */
proc autoreg data=c;
model residual = Time / archtest;
*output out=r r=yresid;
run;
/* end of program */
Cheers,
Koen
BR, Koen
Thank you very much sbxkoenk for the quick and detailed reply. Based on this, I've replied to my own question with a code, do you think it is acceptable as a solution? Thank you very much again.
proc arima data=a identify var=Zt(1,12); estimate p=(0)(0) q=(1)(12) method=ml noconstant; forecast lead=0 interval=month id=Date out=results; run; data residuals_only; set results; if not missing(residual) then do; Time + 1; output; end; keep residual Time; run; /* Test for heteroscedastic residuals */ proc autoreg data=residuals_only; model residual = Time / archtest; output out=r r=yresid; run;
>> ... , I've replied to my own question with a code, do you think it is acceptable as a solution? Thank you very much again.
It's oké.
But you need to terminate PROC ARIMA with a QUIT; statement. PROC ARIMA is an interactive procedure.
Because the PROC ARIMA is followed by a data step (in your code) , there's an implicit QUIT ... but still I prefer to put it.
If you only submit the PROC ARIMA part , you will notice the last statement (the forecast statement) is not executed. The output dataset with residuals is not created.
Interactive procedures in SAS - The DO Loop
Running interactive procedures in SAS Studio and SAS University Edition - The DO Loop
Do you write unnecessary SAS statements? - The DO Loop
Ciao,
Koen
This page contains all the info to interpret the output of ARCHTEST option in PROC AUTOREG!
SAS Help Center: Testing for Heteroscedasticity
Note that you can ask for different flavours of this ARCHTEST option.
I tested ARCHTEST option myself with seriesg (series-G).
Here's more info on Box and Jenkins Series-G (International Airline Passengers)
SAS Help Center: Seasonal Model for the Airline Series
/*-- Seasonal Model for the Airline Series --*/
data seriesg;
set sashelp.air;
xlog = log( air );
run;
proc arima data=seriesg;
identify var=xlog(1,12);
estimate q=(1)(12) noint method=ml;
forecast id=date lead=0 interval=month printall out=b;
run;
QUIT;
data c;
set b;
where residual is not missing;
Time + 1;
run;
/* Test for heteroscedastic residuals */
proc autoreg data=c;
model residual = Time / archtest;
*output out=r r=yresid;
run;
/* end of program */
Cheers,
Koen