/* this SAS code taken from Lab 5 of Dr. Dickey's ST512 webpage @ NCSU*/ /*------------------------------------------------------------------------ Tukey's 1 df test for nonadditivity The Tukey 1 df test for model misspecification is usually written as a somewhat complicated function of various sample means. The hand calculations are given in Steel, Torrie, Dickey pg. 396-398. The following program shows, using the example from the STD book, how to get the test from the computer by simply analyzing the original data then rerunning the analysis with the squared predicted values as an additional predictor variable. *--------------------------------------------------------------------------*/ options ls=75; Data Calcium; title 'Effect of P addition as Na2 PO4 H on Soil Chemical Properties' ; Title2 'Ca (meq 100 g**-1 )' ; Input Sample @; Do P = 0,50,100,150,200; Input Ca @; LOF=P; lca = log(Ca); output; end; label P = 'ppm of P added'; label sample = 'Soil Sample'; cards; 1 3.51 3.68 3.62 3.75 3.71 2 5.07 3.94 3.97 4.03 5.14 3 2.97 2.86 2.92 2.93 3.60 4 2.68 2.50 2.47 2.45 3.12 5 6.54 7.25 7.27 7.13 7.96 6 2.30 3.51 3.38 3.40 3.40 7 2.06 2.06 2.61 2.06 2.22 ; symbol value=dot i=j; proc gplot; title "plot of exchangeable Calcium (Ca) against Phosphate (P) in ppm"; title2 "Can we safely assume treatment effects constant over soil samples?"; title3 "(soil sample)=block"; plot Ca*P=sample; run; proc glm; class sample P; model Ca = sample P; output out=out1 predicted=Pred; Data Tukey; set out1; Tukey = Pred*Pred; proc glm; class sample P; model Ca = sample P Tukey; run;