options ls=78 nodate;
data rad;
input x;
one=1;
cards;
0.15
0.09
0.18
0.10
0.05
0.12
0.08
0.05
0.08
0.10
0.07
0.02
0.01
0.10
0.10
0.10
0.02
0.10
0.01
0.40
0.10
0.05
0.03
0.05
0.15
0.10
0.15
0.09
0.08
0.18
0.10
0.20
0.11
0.30
0.02
0.20
0.20
0.30
0.30
0.40
0.30
0.05
;
run;
proc univariate data=rad normal plot;
var x; /* note in results that hypothesis of normality is rejected*/
run;
/* In the QC (quality control) portion of SAS (which won't necessarily be
part of any given installation of SAS, but is available in the statistics
lab) there is a macro called adxtrans which will compute the MLE of lambda,
the Box-Cox transformation parameter. (The Box-Cox family of transformations
is defined slightly differently than the power family, but this is for purely
mathematical reasons - the maximizing value of lambda can be taken as the
estimate of the power transformation parameter.) It can be shown that the
maximum likelihood estimator of lambda is the minimizer of the root mean
square error of the transformed random variable. Therefore, adxtrans computes
and plots the r.m.s.e. rather than the loglikelihood. The loglikelihood is
also computed by adxtrans, but it is not plotted. Both the r.m.s.e. and the
loglikelihood values are output into the data set adxreg. adxtrans is defined
to operate as part of the analysis of a designed experiment, so one of the
arguments for this macro is supposed to be the model for the experiment. This
model argument can be omitted and the macro will work, but it generates an
error message in the log file which can be ignored. For documentation on
adxtrans, see
http://www.rcr.uga.edu/sasdoc/onldoc.htm
and click on the plus sign in the left
hand frame by SAS/QC, then click the plus next to SAS/QC User's Guide, then
click Macros for the Design and Analysis of Experiments, then click
General Macros:ADXGEN File, then click ADXTRANS. An alternative macro is
available in SAS/ETS - see tranex2.sas */
%adxgen;
%adxtrans(rad,tranout,x); /* by default the grid of lambda values involves 21
values of lambda between -2 and 2 */
proc print data=adxreg;/*compare with results on p.208 of text*/
run;
%adxtrans(rad,tranout,x,,.2,.3,11); /* change grid of lambda values to include
11 values between .2 and .3 (refine grid)*/
%adxtrans(rad,tranout,x,,.27,.29,21);/* further narrow the search */
data tran;
set rad;
xtran=x**.25; /* best to use meaningful transformations (fourth-root rather
than .276th power) */
run;
proc univariate data=tran normal plot;
var xtran; /* note in output that Shapiro-Wilk test of normality is not rejected
for transformed random variable */
run;