Resources

Iterative Outlier Detection

/*--------------------------------------------------------------

                    SAS Sample Library

        Name: ariex07.sas
 Description: Example program from SAS/ETS User's Guide,
              The ARIMA Procedure
       Title: Iterative Outlier Detection
     Product: SAS/ETS Software
        Keys: time series analysis
        PROC: ARIMA
       Notes:

--------------------------------------------------------------*/

data airline;
   set sashelp.air;
   logair = log(air);
   if _n_ = 50 then logair = logair - 0.25;
   if _n_ >= 100 then logair = logair + 0.5;
run;

/*-- Outlier Detection --*/
proc arima data=airline;
   identify var=logair( 1, 12 )  noprint;
   estimate q= (1)(12) noint method= ml;
   outlier maxnum=3 alpha=0.01;
run;

data airline;
   set airline;
   if _n_ = 50 then AO = 1;
   else AO = 0.0;
   if _n_ >= 100 then LS  = 1;
   else LS = 0.0;
run;

/*-- Airline Model with Outliers --*/
proc arima data=airline;
   identify var=logair(1, 12)
            crosscorr=( AO(1, 12) LS(1, 12) )
            noprint;
   estimate q= (1)(12) noint
            input=( AO LS )
            method=ml plot;
   outlier maxnum=3 alpha=0.01;
run;