Univariate Location and Scale
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: ROBUST3 */
/* TITLE: Univariate Location and Scale */
/* PRODUCT: IML */
/* DATA: */
/* */
/* SUPPORT: Rick Wicklin UPDATE: SEP 2013 */
/* REF: */
/* MISC: */
/* */
/****************************************************************/
proc iml;
y = { 3, 4, 7, 8, 10, 949, 951 };
optn = j(9,1,.);
call lms(scLMS, coefLMS, wgtLMS, optn, y);
call lts(scLTS, coefLTS, wgtLTS, optn, y);
LMSOutliers = loc(wgtLMS[1,]=0);
LTSOutliers = loc(wgtLTS[1,]=0);
print LMSOutliers, LTSOutliers;
rLoc = {"Mean", "Median", "LMS Location", "LTS Location"};
Loc = mean(y) // median(y) // coefLMS[1] // coefLTS[1];
print Loc[r=rLoc L="Location Estimates"];
rScale = {"StdDev", "MAD", "LMS Scale", "LTS Scale"};
Scale = std(y) // mad(y) // scLMS[7] // scLTS[7];
print Scale[r=rScale L="Scale Estimates"];