1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
70
71 /********************* scab1.sas ***************************/
72 title 'Scab Disease Data';
73
74 data potato;
75 infile '/home/brunner0/441s20/ScabDisease.data.txt';
76 length condition $ 10.; /* Default length of character values is 8. */
77 input condition $ infection;
78 label infection = 'Ave percent surface covered';
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:15: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.01 seconds
system cpu time 0.01 seconds
memory 754.65k
OS Memory 32168.00k
Timestamp 01/08/2020 03:37:34 PM
Step Count 45 Switch Count 2
Page Faults 0
Page Reclaims 162
Page Swaps 0
Voluntary Context Switches 16
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
79 proc freq;
80 tables condition;
81
NOTE: There were 32 observations read from the data set WORK.POTATO.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.03 seconds
user cpu time 0.03 seconds
system cpu time 0.00 seconds
memory 2573.03k
OS Memory 32940.00k
Timestamp 01/08/2020 03:37:34 PM
Step Count 46 Switch Count 2
Page Faults 0
Page Reclaims 262
Page Swaps 0
Voluntary Context Switches 9
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 272
82 proc means;
83 class condition;
84 var infection;
85
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 8387.40k
OS Memory 40892.00k
Timestamp 01/08/2020 03:37:34 PM
Step Count 47 Switch Count 1
Page Faults 0
Page Reclaims 1963
Page Swaps 0
Voluntary Context Switches 14
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
86 proc glm;
87 class condition;
88 model infection = condition / clparm;
89 /* clparm gives CIs for contrasts down in the estimate statements. */
90 /* Pairwise multiple comparisons */
91 lsmeans condition / pdiff tdiff adjust = tukey;
92 lsmeans condition / pdiff tdiff adjust = bon;
93 lsmeans condition / pdiff tdiff adjust = scheffe;
94 /* Test some custom contrasts. Beware of alphabetical order:
95 Control Fall1200 Fall300 Fall600 Spring1200 Spring300 Spring600*/
96 contrast 'Overall test for comparison' condition 1 -1 0 0 0 0 0,
97 condition 1 0 -1 0 0 0 0,
98 condition 1 0 0 -1 0 0 0,
99 condition 1 0 0 0 -1 0 0,
100 condition 1 0 0 0 0 -1 0,
101 condition 1 0 0 0 0 0 -1;
102
103 contrast 'Av. of Fall vs. Control' condition 3 -1 -1 -1 0 0 0;
104 contrast 'Av. of Spring vs. Control' condition 3 0 0 0 -1 -1 -1;
105 contrast 'Fall vs. Spring' condition 0 1 1 1 -1 -1 -1;
106
107 contrast 'Spring Amount' condition 0 0 0 0 1 -1 0,
108 condition 0 0 0 0 0 1 -1;
109
110 contrast 'Fall Amount' condition 0 1 -1 0 0 0 0,
111 condition 0 0 1 -1 0 0 0;
112
113 contrast 'Spr vs. Fall for 300 lbs.' condition 0 0 1 0 0 -1 0;
114 contrast 'Spr vs. Fall for 600 lbs.' condition 0 0 0 1 0 0 -1;
115 contrast 'Spr vs. Fall, 1200 lbs' condition 0 1 0 0 -1 0 0;
116
117 /* Estimate and CI for Control vs. Fall 1200 (F = t^2) */
118 estimate 'Control vs. Fall 1200' condition 1 -1 0 0 0 0 0;
119 estimate 'Control vs. Mean of Fall'
120 condition 3 -1 -1 -1 0 0 0 / divisor = 3;
121
122
123 /* Scheffe critical value for a test of s contrasts is critval * (p-1)/s.
124 For p=7 means and a single contrast, it's critval * (7-1)/1 */
NOTE: PROCEDURE GLM used (Total process time):
real time 1.28 seconds
user cpu time 0.76 seconds
system cpu time 0.03 seconds
memory 19274.04k
OS Memory 50524.00k
Timestamp 01/08/2020 03:37:35 PM
Step Count 48 Switch Count 2
Page Faults 0
Page Reclaims 5575
Page Swaps 0
Voluntary Context Switches 4252
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 2680
125 proc iml;
NOTE: IML Ready
126 title2 'Critical value for all possible 1-df Scheffe F-tests';
127 numdf = 6;
127 ! /* p-1 = Numerator degrees of freedom for initial test */
128 dendf = 25;
128 ! /* n-p = Denominator degrees of freedom for initial test */
129 alpha = 0.05;
130 critval = finv(1-alpha,numdf,dendf);
130 ! print critval;
131 ScheffeCritval = critval*numdf;
131 ! print ScheffeCritval;
132
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 468.71k
OS Memory 48548.00k
Timestamp 01/08/2020 03:37:35 PM
Step Count 49 Switch Count 1
Page Faults 0
Page Reclaims 139
Page Swaps 0
Voluntary Context Switches 9
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
133 proc iml;
NOTE: IML Ready
134 title2 'Table of Scheffe critical values for COLLECTIONS of contrasts';
135 numdf = 6;
135 ! /* Numerator degrees of freedom for initial test */
136 dendf = 25;
136 ! /* Denominator degrees of freedom for initial test */
137 alpha = 0.05;
138 critval = finv(1-alpha,numdf,dendf);
139 zero = {0 0};
139 ! S_table = repeat(zero,numdf,1);
139 ! /* Make empty matrix */
140 /* Label the columns */
141 namz = {"Number of Contrasts in followup F-test"
142 " Scheffe Critical Value"};
143 mattrib S_table colname=namz;
144 do i = 1 to numdf;
145 s_table(|i,1|) = i;
146 s_table(|i,2|) = numdf/i * critval;
147 end;
148 reset noname;
148 ! /* Makes output look nicer in this case */
149 print "Initial test has" numdf " and " dendf "degrees of freedom."
150 "Using significance level alpha = " alpha;
151 print s_table;
152
153 /* Example of subsetting vs. contrasts */
154
NOTE: Exiting IML.
NOTE: PROCEDURE IML used (Total process time):
real time 0.02 seconds
user cpu time 0.02 seconds
system cpu time 0.00 seconds
memory 536.37k
OS Memory 48548.00k
Timestamp 01/08/2020 03:37:35 PM
Step Count 50 Switch Count 1
Page Faults 0
Page Reclaims 134
Page Swaps 0
Voluntary Context Switches 10
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
155 proc glm;
156 title2 'Test differences among treatments excluding control';
157 title3 'Using contrasts of all means (traditional)';
158 class condition;
159 model infection = condition;
160 contrast 'Differences excluding control' condition 0 1 -1 0 0 0 0,
161 condition 0 0 1 -1 0 0 0,
162 condition 0 0 0 1 -1 0 0,
163 condition 0 0 0 0 1 -1 0,
164 condition 0 0 0 0 0 1 -1;
165
NOTE: PROCEDURE GLM used (Total process time):
real time 0.23 seconds
user cpu time 0.12 seconds
system cpu time 0.01 seconds
memory 4067.28k
OS Memory 50752.00k
Timestamp 01/08/2020 03:37:36 PM
Step Count 51 Switch Count 4
Page Faults 0
Page Reclaims 494
Page Swaps 0
Voluntary Context Switches 659
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 752
166 proc glm;
167 title2 'Test differences among treatments excluding control';
168 title3 'Subset the data by excluding control';
169 where condition ne 'Control'; /* Case sensitive */
170 class condition;
171 model infection = condition;
172
173
174
175 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
186