|
Two sample t-test with SAS
Comparing test and control setA common experiment design is to have a test and control conditions and then randomly assign a subject into either one. One variable to be measured and compared between two conditions. In the experiment, a new study method is compared to a standard one, and the reading score (after taking a study method) is recorded. The data set is “reading.csv”. Is there significant evidence that the new study method would get a different reading grade (on average) than the control method? Setting up the dataOpen the data set from SAS. If the data set is small, it can be manually input. Analyzing the data, syntaxproc ttest data=read; title "Two sample t-test example"; class method; var grade; run; Checking assumptionsTwo sample t-test assumes that
Reading the outputtwo sample t example The TTEST Procedure Variable: Grade Method N Mean Std Dev Std Err Minimum Maximum control 5 88.6000 7.3007 3.2650 80.0000 98.0000 treatment 5 101.6 2.0736 0.9274 99.0000 104.0 Diff (1-2) -13.0000 5.3666 3.3941 Method Method Mean 95% CL Mean Std Dev 95% CL Std Dev control 88.6000 79.5350 97.6650 7.3007 4.3741 20.9789 treatment 101.6 99.0252 104.2 2.0736 1.2424 5.9587 Diff (1-2) Pooled -13.0000 -20.8268 -5.1732 5.3666 3.6249 10.2811 Diff (1-2) Satterthwaite -13.0000 -21.9317 -4.0683 Method Variances DF t Value Pr > |t| Pooled Equal 8 -3.83 0.0050 Satterthwaite Unequal 4.6412 -3.83 0.0141 Equality of Variances Method Num DF Den DF F Value Pr > F Folded F 4 4 12.40 0.0318 Interpreting the resultBased on the data, conduct a hypothesis test (with a 0.05 significance level) to see if there is evidence that the reading score is significantly different in the treatment than control group. Use α= 0.05. The last part of the result is to check whether the variances of the two groups are equal. Some people use the simple rule here: if the probabiliyt is greater than 0.05, then the variances are equal and use the results for the equal variances. Other wise use the result for unequal variances. Since it it 0.0318, we read the p-value for unequal variance situation. The corresponding t-value = -3.83, and the p-value is 0.0141. Note that SAS only perform a two side test, meaning the hypothesis is to compare a significant difference between two groups. If one wants to test whether one group is greater(smaller) than the other, p-value must be divided by 2. For example, the p-value/2=0.0141/2=0.007 < 0.05, hence the concluse for the one side test is to reject the hypothesis and therefore the new method improve the grading score. |
© COPYRIGHT 2010 ALL RIGHTS RESERVED tqin@purdue.edu |