SAS Program for Constructing a Normal Probability Plot

advertisement
SAS Program for Constructing a Normal Probability Plot
The following SAS program will construct a normal (or other) probability plot, with associated statistics, for
a data set.
data one;
input y;
label y = "Rubber Strip Length";
/* The following statement creates a dummy variable with value 1 for every */
/* observation in the data set. This variable will be used to merge the sample */
/* statistics with every observation in the original data set. */
dum = 1;
cards;
4.03
4.04
4.16
4.02
4.18
4.14
4.11
4.13
4.19
3.94
4.21
4.25
;
proc sort;by y;
;
proc means;
var y;
output out=meany mean=mu std=s n=size;
;
data two;set meany;dum = 1;
;
data three;merge one two;by dum;
p = (_n_ - 0.5)/size;
/* The following equation would need to be changed for q-q plots for other */
/* probability distributions. For example, for an exponential(mu) distribution, */
/* the statement would be Q = -mu*log(1-p). To do a Weibull probability plot, */
/* the statement would be */
/* Q = exp(mu+(0.57722*s*sqrt(6)/3.1415926))*((-log(1-p))**(s*sqrt(6)/3.1415926)) */
Q = probit(p);
;
proc reg;
model y = Q / noprint;
plot (y predicted.)*Q / overlay;
title 'Normal Probability Plot';
;
run;
Download