Paried t-test procedure demonstrated with an example
A common experiment design is to have a test and control conditions. While the regular two-sample t-test assumes independence, paired t-test assumes that the two samples are dependent. For example, in an experiment where the response time is measured with or without taking a drug. Each subject could have been measured twice, once in the absence of the drug (control value) and the other after taking the drug (treatment value).
The question is whether the response time differs between the two conditions? The model is
response (continuous) ~ drug (categorical: 2 levels)
The data is "response.csv".
Open the data set from SAS. Or import with the following command.
data response; infile "H:\sas\data\response.csv" dlm=',' firstobs=2; input control treatment; run;
Paired sample t-test assumes that
When the assumptions are not met, other methods are possible based on the two samples:
The regular t-test cannot be used here since the groups are no longer independent. In stead, a paried t-test is more appropiate.
Compare two sample with paired t-test
proc ttest data=response sides=2 alpha=0.05 h0=0; title "Paired sample t-test example"; paired Control * Treatment; run;
The output is shown below.
Paired sample t-test example The TTEST Procedure Difference: control - treatment N Mean Std Dev Std Err Minimum Maximum 6 -7.3333 4.1312 1.6865 -15.0000 -4.0000 Mean 95% CL Mean Std Dev 95% CL Std Dev -7.3333 -11.6687 -2.9979 4.1312 2.5787 10.1322 DF t Value Pr > |t| 5 -4.35 0.0074
As a significance level of 0.05, the hypothesis is whether the response time is significantly different in the treatment than control group.
We can state that response times are longer under the treatment than the control group
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.0074/2=0.00342 < 0.05, hence the concluse for the one side test is still to reject the hypothesis.
|© COPYRIGHT 2010 ALL RIGHTS RESERVED firstname.lastname@example.org|