1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;NOTE: ODS statements in the SAS Studio environment may disable some output features.7374 /********************* scab2.sas (2018 verion) **********************/75 title 'Randomization Tests on the Scab Disease Data';7677 data potato;78 infile '/folders/myfolders/441s18/Lecture/ScabDisease.data.txt';79 length condition $ 10.; /* Default length of character values is 8. */80 input condition $ infection;81 label infection = 'Ave percent surface covered';8283 ods select OverallANOVA;NOTE: The infile '/folders/myfolders/441s18/Lecture/ScabDisease.data.txt' is:Filename=/folders/myfolders/441s18/Lecture/ScabDisease.data.txt,Owner Name=root,Group Name=vboxsf,Access Permission=-rwxrwx---,Last Modified=11Feb2018:15:28:04,File Size (bytes)=578NOTE: 33 records were read from the infile '/folders/myfolders/441s18/Lecture/ScabDisease.data.txt'.The minimum record length was 0.The maximum record length was 16.NOTE: SAS went to a new line when INPUT statement reached past the end of a line.NOTE: The data set WORK.POTATO has 32 observations and 2 variables.NOTE: DATA statement used (Total process time):real time 0.00 secondscpu time 0.01 seconds84 proc glm data=potato order=data;85 title2 'With proc glm for Comparison';86 class condition;87 model infection=condition;88 run;89NOTE: PROCEDURE GLM used (Total process time):real time 0.05 secondscpu time 0.05 seconds90 proc npar1way wilcoxon data=potato;91 title2 'Classical Kruskal-Wallis Test';92 class condition;93 var infection;94 exact / mc seed=77777 maxtime=300;95 /* It will never take 5 minutes, but just to be safe .... */96 run;NOTE: PROCEDURE NPAR1WAY used (Total process time):real time 0.42 secondscpu time 0.20 seconds9798 proc npar1way scores=data data=potato;99 title2 'Randomization Test';100 class condition;101 var infection;102 exact / mc seed=88888 maxtime=300;103 run;NOTE: PROCEDURE NPAR1WAY used (Total process time):real time 0.30 secondscpu time 0.14 seconds104105 /* Follow up with proc multtest. All 21 pairwise comparisons plus106 * Control vs. Average of Spring107 * Control vs. Average of Fall108 * Average of Spring vs. Average of Fall109 */110111 proc multtest data=potato order=data112 permutation nsample=20000 seed=99999 ;113 title2 'Randomization multiple comparisons with proc multtest';114 class condition;115 /* Pairwise Bonferroni */116 contrast 'Control vs. Spring300' 1 -1 0 0 0 0 0; /* 1.0000 */117 contrast 'Control vs. Spring600' 1 0 -1 0 0 0 0; /* 1.0000 */118 contrast 'Control vs. Spring1200' 1 0 0 -1 0 0 0; /* 1.0000 */119 contrast 'Control vs. Fall300' 1 0 0 0 -1 0 0; /* 0.0888 */120 contrast 'Control vs. Fall600' 1 0 0 0 0 -1 0; /* 1.0000 */121 contrast 'Control vs. Fall1200' 1 0 0 0 0 0 -1; /* 0.0096 */122 contrast 'Spring300 vs. Spring600' 0 1 -1 0 0 0 0;123 contrast 'Spring300 vs. Spring1200' 0 1 0 -1 0 0 0;124 contrast 'Spring300 vs. Fall300' 0 1 0 0 -1 0 0;125 contrast 'Spring300 vs. Fall600' 0 1 0 0 0 -1 0;126 contrast 'Spring300 vs. Fall1200' 0 1 0 0 0 0 -1;127 contrast 'Spring600 vs. Spring1200' 0 0 1 -1 0 0 0;128 contrast 'Spring600 vs. Fall300' 0 0 1 0 -1 0 0;129 contrast 'Spring600 vs. Fall600' 0 0 1 0 0 -1 0;130 contrast 'Spring600 vs. Fall1200' 0 0 1 0 0 0 -1;131 contrast 'Spring1200 vs. Fall300' 0 0 0 1 -1 0 0;132 contrast 'Spring1200 vs. Fall600' 0 0 0 1 0 -1 0;133 contrast 'Spring1200 vs. Fall1200' 0 0 0 1 0 0 -1;134 contrast 'Fall300 vs. Fall600' 0 0 0 0 1 -1 0;135 contrast 'Fall300 vs. Fall1200' 0 0 0 0 1 0 -1;136 contrast 'Fall600 vs. Fall1200' 0 0 0 0 0 1 -1;137 /* Averages */138 contrast 'Control vs. Spring' 3 -1 -1 -1 0 0 0;139 contrast 'Control vs. Fall' 3 0 0 0 -1 -1 -1;140 contrast 'Spring vs. Fall' 0 1 1 1 -1 -1 -1;141 test mean(infection); /* Requests t-tests */142 run;NOTE: The multiple testing procedure for this run is not closed. In cases with badly heteroskedastic data, tests for individualnull hypotheses can have inflated familywise Type I error rates.NOTE: There were 32 observations read from the data set WORK.POTATO.NOTE: PROCEDURE MULTTEST used (Total process time):real time 0.31 secondscpu time 0.30 seconds143144 /* The only issue is Controll vs. Fall300. p = 0.0519, but it's an145 ESTIMATE of the p-value from a randomization test. Is it146 SIGNIFICANTLY above 0.05? */147148 proc iml;NOTE: IML Ready149 title2 'Testing H0: p = 0.05 with a large-sample Z-test for proportions';150 p = 0.0519;150 ! n = 20000;150 ! Z = sqrt(n)*(p-0.05)/(0.05*0.95);151 print p Z;152153154155156157158159160 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;173