options nodate nonumber ps=55 ls=80; title 'Kuehl -- Chapter 4 -- Residual-Fitted Spread Plots'; data crab; do site=1 to 6; do rep=1 to 25; input count @@; tcount=count+(1/6); tcount=((tcount**(-0.5))-1)/(-0.5); output; end; end; datalines; 0 0 22 3 17 0 0 7 11 11 73 33 0 65 13 44 20 27 48 104 233 81 22 9 2 415 466 6 14 12 0 3 1 16 55 142 10 2 145 6 4 5 124 24 204 0 0 56 0 8 0 0 4 13 5 1 1 4 4 36 407 0 0 18 4 14 0 24 52 314 245 107 5 6 2 0 0 0 4 2 2 5 4 2 1 0 12 1 30 0 3 28 2 21 8 82 12 10 2 0 0 1 1 2 2 1 2 29 2 2 0 13 0 19 1 3 26 30 5 4 94 1 9 3 0 0 0 0 2 3 0 0 4 0 5 4 22 0 64 4 4 43 3 16 19 95 6 22 0 0 ; run; proc glm noprint; class site; model tcount=site; output out=err_out r=ehat p=ybar; run; proc sort; by ehat; run; data two; set err_out; i=_n_; f_i=(i-0.5)/150; nq_i=probit(f_i); run; proc plot; plot ehat*nq_i /vaxis=-4 to 4 by 1; title2 'Normal Probability Plot -- Negative Square Root Count'; run; proc sort data=err_out; by ybar; run; proc means data=err_out; var ybar; output out=err_out1 mean=ybarmean; run; data err_out1; set err_out1; do i=1 to 150; output; end; data err_out2; merge err_out err_out1; ybar_c = ybar-ybarmean; run; data fitnor; set err_out2; i=_n_; ff_i=(i-0.5)/150; nqf_i=probit(ff_i); run; /* Give normal scores for fitted values (group means) -- Kuehl pp 141-143 */ proc plot; plot ybar_c*nqf_i / vaxis=-4 to 4 by 1; /* r-f plot (Kuehl, pp 141-143) */ run;