Chapter Contents Previous Next
 The X11 Procedure

## Example 21.3: Outlier Detection and Removal

PROC X11 can be used to detect and replace outliers in the irregular component of a monthly or quarterly series.

The weighting scheme used in measuring the "extremeness" of the irregulars is developed iteratively; thus the statistical properties of the outlier adjustment method are unknown.

In this example, the data is simulated by generating a trend plus a random error. Two periods in the series were made "extreme" by multiplying one generated value by 2.0 and another by 0.10. The additive model is appropriate based on the way the data was generated. Note that the trend in the generated data was modeled automatically by the trend cycle component estimation.

The detection of outliers is accomplished by considering table D9, the final replacement values for extreme S-I ratios. This table indicates which observations had irregular component values more than FULLWEIGHT= standard deviation units from 0.0 (1.0 for the multiplicative model). The default value of the FULLWEIGHT= option is 1.5; a larger value would result in fewer observations being declared extreme.

In this example, FULLWEIGHT=3.0 is used to isolate the extreme inflated and deflated values generated in the data step. The value of ZEROWEIGHT= must be greater than FULLWEIGHT; it is given a value of 3.5.

A plot of the original and modified series, Output 21.3.2, shows that the deviation from the trend line for the modified series is greatly reduced compared with the original series.

```   data a;
retain seed 99831;
do kk = 1 to 48;
x = kk + 100 + rannor( seed );
date = intnx( 'month', '01jan1970'd, kk-1 );
if kk = 20 then x = 2 * x;
else if kk = 30 then x = x / 10;
output;
end;
run;

proc x11 data=a;
fullweight=3.0 zeroweight=3.5;
var x;
table d9;
output out=b b1=original e1=e1;
run;

symbol1 i=join v=star;
symbol2 i=join v=circle;
legend1 label=none value=('unmodified' 'modified');

proc gplot data= b;
plot original * date = 1 e1 * date = 2 / overlay legend=legend1;
format date monyy7.;
run;
```

Output 21.3.1: Detection of Extreme Irregulars

 The X11 Procedure Seasonal Adjustment of - x

 D9 Final Replacement Values for Extreme SI Ratios Year JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC 1970 . . . . . . . . . . . . 1971 . . . . . . . 11.180 . . . . 1972 . . . . . -10.671 . . . . . . 1973 . . . . . . . . . . . .

Output 21.3.2: Plot of Modified and Unmodified Values

 Chapter Contents Previous Next Top