1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
71
72 /********************* scab2.sas (2020 version) **********************/
73 title 'Randomization Tests on the Scab Disease Data';
74
75 data potato;
76 infile '/home/brunner0/441s20/ScabDisease.data.txt';
77 length condition $ 10.; /* Default length of character values is 8. */
78 input condition $ infection;
79 label infection = 'Ave percent surface covered';
80
81 ods select OverallANOVA;
NOTE: The infile '/home/brunner0/441s20/ScabDisease.data.txt' is:
Filename=/home/brunner0/441s20/ScabDisease.data.txt,
Owner Name=brunner0,Group Name=oda,
Access Permission=-rw-r--r--,
Last Modified=04Jan2020:16:00:45,
File Size (bytes)=578
NOTE: 33 records were read from the infile '/home/brunner0/441s20/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 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 754.46k
OS Memory 29096.00k
Timestamp 03/29/2020 02:59:01 PM
Step Count 62 Switch Count 3
Page Faults 0
Page Reclaims 165
Page Swaps 0
Voluntary Context Switches 29
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
82 proc glm data=potato order=data;
83 title2 'With proc glm for Comparison';
84 class condition;
85 model infection=condition;
86 run;
87
NOTE: PROCEDURE GLM used (Total process time):
real time 0.03 seconds
user cpu time 0.04 seconds
system cpu time 0.00 seconds
memory 3836.46k
OS Memory 31416.00k
Timestamp 03/29/2020 02:59:01 PM
Step Count 63 Switch Count 3
Page Faults 0
Page Reclaims 585
Page Swaps 0
Voluntary Context Switches 22
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 744
88 proc means data = potato order=data;
89 class condition; var infection;
90 run;
NOTE: There were 32 observations read from the data set WORK.POTATO.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.03 seconds
user cpu time 0.02 seconds
system cpu time 0.01 seconds
memory 8372.78k
OS Memory 38844.00k
Timestamp 03/29/2020 02:59:01 PM
Step Count 64 Switch Count 1
Page Faults 0
Page Reclaims 2182
Page Swaps 0
Voluntary Context Switches 24
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
91
92 proc npar1way wilcoxon data=potato;
93 title2 'Classical Kruskal-Wallis Test';
94 class condition;
95 var infection;
96 exact / mc seed=77777 maxtime=300;
97 /* It will never take 5 minutes, but just to be safe .... */
98 run;
NOTE: PROCEDURE NPAR1WAY used (Total process time):
real time 2.53 seconds
user cpu time 0.17 seconds
system cpu time 0.02 seconds
memory 14797.34k
OS Memory 44716.00k
Timestamp 03/29/2020 02:59:04 PM
Step Count 65 Switch Count 1
Page Faults 0
Page Reclaims 4371
Page Swaps 0
Voluntary Context Switches 792
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 896
99
100 proc npar1way scores=data data=potato;
101 title2 'Randomization Test';
102 class condition;
103 var infection;
104 exact / mc seed=88888 maxtime=300;
105 run;
NOTE: PROCEDURE NPAR1WAY used (Total process time):
real time 0.31 seconds
user cpu time 0.12 seconds
system cpu time 0.01 seconds
memory 3146.09k
OS Memory 46132.00k
Timestamp 03/29/2020 02:59:04 PM
Step Count 66 Switch Count 1
Page Faults 0
Page Reclaims 541
Page Swaps 0
Voluntary Context Switches 627
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 696
106
107 /* Follow up with proc multtest. All 21 pairwise comparisons plus
108 * Control vs. Average of Spring
109 * Control vs. Average of Fall
110 * Average of Spring vs. Average of Fall
111 */
112
113 proc multtest data=potato order=data
114 permutation nsample=20000 seed=99999 ;
115 title2 'Randomization multiple comparisons with proc multtest';
116 class condition;
117 /* Pairwise Bonferroni */
118 contrast 'Control vs. Spring300' 1 -1 0 0 0 0 0; /* 1.0000 */
119 contrast 'Control vs. Spring600' 1 0 -1 0 0 0 0; /* 1.0000 */
120 contrast 'Control vs. Spring1200' 1 0 0 -1 0 0 0; /* 1.0000 */
121 contrast 'Control vs. Fall300' 1 0 0 0 -1 0 0; /* 0.0888 */
122 contrast 'Control vs. Fall600' 1 0 0 0 0 -1 0; /* 1.0000 */
123 contrast 'Control vs. Fall1200' 1 0 0 0 0 0 -1; /* 0.0096 */
124 contrast 'Spring300 vs. Spring600' 0 1 -1 0 0 0 0;
125 contrast 'Spring300 vs. Spring1200' 0 1 0 -1 0 0 0;
126 contrast 'Spring300 vs. Fall300' 0 1 0 0 -1 0 0;
127 contrast 'Spring300 vs. Fall600' 0 1 0 0 0 -1 0;
128 contrast 'Spring300 vs. Fall1200' 0 1 0 0 0 0 -1;
129 contrast 'Spring600 vs. Spring1200' 0 0 1 -1 0 0 0;
130 contrast 'Spring600 vs. Fall300' 0 0 1 0 -1 0 0;
131 contrast 'Spring600 vs. Fall600' 0 0 1 0 0 -1 0;
132 contrast 'Spring600 vs. Fall1200' 0 0 1 0 0 0 -1;
133 contrast 'Spring1200 vs. Fall300' 0 0 0 1 -1 0 0;
134 contrast 'Spring1200 vs. Fall600' 0 0 0 1 0 -1 0;
135 contrast 'Spring1200 vs. Fall1200' 0 0 0 1 0 0 -1;
136 contrast 'Fall300 vs. Fall600' 0 0 0 0 1 -1 0;
137 contrast 'Fall300 vs. Fall1200' 0 0 0 0 1 0 -1;
138 contrast 'Fall600 vs. Fall1200' 0 0 0 0 0 1 -1;
139 /* Averages */
140 contrast 'Control vs. Spring' 3 -1 -1 -1 0 0 0;
141 contrast 'Control vs. Fall' 3 0 0 0 -1 -1 -1;
142 contrast 'Spring vs. Fall' 0 1 1 1 -1 -1 -1;
143 test mean(infection); /* Requests t-tests */
144 run;
NOTE: The multiple testing procedure for this run is not closed. In cases with badly heteroskedastic data, tests for individual
null 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 seconds
user cpu time 0.32 seconds
system cpu time 0.00 seconds
memory 1178.37k
OS Memory 45224.00k
Timestamp 03/29/2020 02:59:05 PM
Step Count 67 Switch Count 1
Page Faults 0
Page Reclaims 77
Page Swaps 0
Voluntary Context Switches 13
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 48
145
146 /* The only issue is Controll vs. Fall300. p = 0.0519, but it's an
147 ESTIMATE of the p-value from a randomization test. Is it
148 SIGNIFICANTLY above 0.05? */
149
150 proc iml;
NOTE: IML Ready
151 title2 'Testing H0: p = 0.05 with a large-sample Z-test for proportions';
152 p = 0.0519;
152 ! n = 20000;
152 ! Z = sqrt(n)*(p-0.05)/sqrt(0.05*0.95);
153 print p Z;
154 quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 0.01 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 509.50k
OS Memory 44964.00k
Timestamp 03/29/2020 02:59:05 PM
Step Count 68 Switch Count 1
Page Faults 0
Page Reclaims 133
Page Swaps 0
Voluntary Context Switches 11
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
155
156 /* Try a bigger MC sample size: 200 thousand. */
157
158 proc multtest data=potato order=data
159 permutation nsample=200000 seed=99999 ;
160 title2 'Bigger MC sample size: See Control vs. Fall300';
161 class condition;
162 /* Pairwise Bonferroni */
163 contrast 'Control vs. Spring300' 1 -1 0 0 0 0 0; /* 1.0000 */
164 contrast 'Control vs. Spring600' 1 0 -1 0 0 0 0; /* 1.0000 */
165 contrast 'Control vs. Spring1200' 1 0 0 -1 0 0 0; /* 1.0000 */
166 contrast 'Control vs. Fall300' 1 0 0 0 -1 0 0; /* 0.0888 */
167 contrast 'Control vs. Fall600' 1 0 0 0 0 -1 0; /* 1.0000 */
168 contrast 'Control vs. Fall1200' 1 0 0 0 0 0 -1; /* 0.0096 */
169 contrast 'Spring300 vs. Spring600' 0 1 -1 0 0 0 0;
170 contrast 'Spring300 vs. Spring1200' 0 1 0 -1 0 0 0;
171 contrast 'Spring300 vs. Fall300' 0 1 0 0 -1 0 0;
172 contrast 'Spring300 vs. Fall600' 0 1 0 0 0 -1 0;
173 contrast 'Spring300 vs. Fall1200' 0 1 0 0 0 0 -1;
174 contrast 'Spring600 vs. Spring1200' 0 0 1 -1 0 0 0;
175 contrast 'Spring600 vs. Fall300' 0 0 1 0 -1 0 0;
176 contrast 'Spring600 vs. Fall600' 0 0 1 0 0 -1 0;
177 contrast 'Spring600 vs. Fall1200' 0 0 1 0 0 0 -1;
178 contrast 'Spring1200 vs. Fall300' 0 0 0 1 -1 0 0;
179 contrast 'Spring1200 vs. Fall600' 0 0 0 1 0 -1 0;
180 contrast 'Spring1200 vs. Fall1200' 0 0 0 1 0 0 -1;
181 contrast 'Fall300 vs. Fall600' 0 0 0 0 1 -1 0;
182 contrast 'Fall300 vs. Fall1200' 0 0 0 0 1 0 -1;
183 contrast 'Fall600 vs. Fall1200' 0 0 0 0 0 1 -1;
184 /* Averages */
185 contrast 'Control vs. Spring' 3 -1 -1 -1 0 0 0;
186 contrast 'Control vs. Fall' 3 0 0 0 -1 -1 -1;
187 contrast 'Spring vs. Fall' 0 1 1 1 -1 -1 -1;
188 test mean(infection); /* Requests t-tests */
189 run;
NOTE: The multiple testing procedure for this run is not closed. In cases with badly heteroskedastic data, tests for individual
null 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 2.22 seconds
user cpu time 2.23 seconds
system cpu time 0.00 seconds
memory 847.21k
OS Memory 45224.00k
Timestamp 03/29/2020 02:59:07 PM
Step Count 69 Switch Count 1
Page Faults 0
Page Reclaims 51
Page Swaps 0
Voluntary Context Switches 13
Involuntary Context Switches 3
Block Input Operations 0
Block Output Operations 48
190
191 proc iml;
NOTE: IML Ready
192 title2 'Another large-sample Z-test of H0: p = 0.05';
193 p = 0.0515;
193 ! n = 200000;
193 ! Z = sqrt(n)*(p-0.05)/sqrt(0.05*0.95);
194 print p Z;
195 quit;
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 0.01 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 501.15k
OS Memory 44964.00k
Timestamp 03/29/2020 02:59:07 PM
Step Count 70 Switch Count 1
Page Faults 0
Page Reclaims 133
Page Swaps 0
Voluntary Context Switches 11
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
196
197
198
199
200
201 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
212