The UNIVARIATE Procedure

Example 4.11 Computing Robust Estimates

This example illustrates how you can use the UNIVARIATE procedure to compute robust estimates of location and scale. The following statements compute these estimates for the variable Systolic in the data set BPressure, which was introduced in Example 4.1:

title 'Robust Estimates for Blood Pressure Data';
ods select TrimmedMeans WinsorizedMeans RobustScale;
proc univariate data=BPressure trimmed=1 .1
                winsorized=.1  robustscale;
   var Systolic;
run;

The ODS SELECT statement restricts the output to the "TrimmedMeans," "WinsorizedMeans," and "RobustScale" tables; see the section ODS Table Names. The TRIMMED= option computes two trimmed means, the first after removing one observation and the second after removing 10% of the observations. If the value of TRIMMED= is greater than or equal to one, it is interpreted as the number of observations to be trimmed. The WINSORIZED= option computes a Winsorized mean that replaces three observations from the tails with the next closest observations. (Three observations are replaced because n p equals left parenthesis 22 right parenthesis left parenthesis .1 right parenthesis equals 2.2, and three is the smallest integer greater than 2.2.) The trimmed and Winsorized means for Systolic are displayed in Output 4.11.1.

Output 4.11.1: Computation of Trimmed and Winsorized Means

Robust Estimates for Blood Pressure Data

The UNIVARIATE Procedure
Variable: Systolic

Trimmed Means
Percent
Trimmed
in Tail
Number
Trimmed
in Tail
Trimmed
Mean
Std Error
Trimmed
Mean
95% Confidence LimitsDFt for H0:
Mu0=0.00
Pr > |t|
4.551120.35002.573536114.9635125.73651946.76446<.0001
13.643120.31252.395387115.2069125.41811550.22675<.0001

Winsorized Means
Percent
Winsorized
in Tail
Number
Winsorized
in Tail
Winsorized
Mean
Std Error
Winsorized
Mean
95% Confidence LimitsDFt for H0:
Mu0=0.00
Pr > |t|
13.643120.63642.417065115.4845125.78821549.91027<.0001


Output 4.11.1 shows the trimmed mean for Systolic is 120.35 after one observation has been trimmed, and 120.31 after 3 observations are trimmed. The Winsorized mean for Systolic is 120.64. For details on trimmed and Winsorized means, see the section Robust Estimators. The trimmed means can be compared with the means shown in Output 4.1.1 (from Example 4.1), which displays the mean for Systolic as 121.273.

The ROBUSTSCALE option requests a table, displayed in Output 4.11.2, which includes the interquartile range, Gini’s mean difference, the median absolute deviation about the median, upper Q Subscript n, and upper S Subscript n.

Output 4.11.2 shows the robust estimates of scale for Systolic. For instance, the interquartile range is 13. The estimates of sigma range from 9.54 to 13.32. See the section Robust Estimators.

A sample program for this example, uniex01.sas, is available in the SAS Sample Library for Base SAS software.

Output 4.11.2: Computation of Robust Estimates of Scale

Robust Measures of Scale
MeasureValueEstimate
of Sigma
Interquartile Range13.000009.63691
Gini's Mean Difference15.0303013.32026
MAD6.500009.63690
Sn9.540809.54080
Qn13.3314011.36786


Last updated: April 16, 2025