/* chisquare_gof1.sas */ /* chi-square GOF tests */ /* First approach */ /* ------------------------------------------- */ data peaplant1; input type $ count; cards; red 705 white 224 ; proc freq data=peaplant1 order=data; tables type / nocum chisq deviation cellchi2 testp=(.75 .25) plots(only)=deviationplot(type=dotplot); weight count; title 'Chi-square GOF test: pea flower color'; run; /* ------------------------------------------- */ data peaplant2; input type $ count; cards; RY 315 WY 101 RG 108 WG 32 ; proc freq data=peaplant2 order=data; tables type / nocum chisq testp=(.5625 .1875 .1875 .0625) plots(only)= deviationplot(type=dotplot); weight count; title 'Chi-square GOF test: pea seed shape/color'; run; /* ------------------------------------------- */ data maize1; input type $ count; cards; green 773 golden 231 grst 238 grgost 59 ; proc freq data=maize1 order=data; tables type / nocum chisq testp=(.5625 .1875 .1875 .0625) plots(only)=deviationplot(type=dotplot); weight count; title 'Chi-square GOF test: maize leaf type'; run; /* ------------------------------------------- */ data maize2; input type $ count; cards; green 773 golden 231 grst 238 ; proc freq data=maize2 order=data; tables type / nocum chisq testp=(.6 .2 .2) plots(only)=deviationplot(type=dotplot); weight count; title 'Chi-square GOF test: maize leaf type (omitting green-golden-striped)'; run;