[R] Two sample t.test, order of comparions

Helmut Schütz helmut.schuetz at bebac.at
Wed Apr 18 14:46:26 CEST 2007


Dear group members,

I want to compare response variables ("logAUC") of two groups (treatment 
"Test", "Reference") of a subset ("period == 1") in dataframe "resp" 
(below):

   sequence subject period treatment  AUC   logAUC
1        RT       1      1 Reference 44.1 3.786460
2        RT       1      2      Test 39.1 3.666122
3        RT       2      1 Reference 33.6 3.514526
4        RT       2      2      Test 23.8 3.169686
5        RT       3      1 Reference 45.5 3.817712
6        RT       3      2      Test 40.8 3.708682
7        TR       4      1      Test 19.5 2.970414
8        TR       4      2 Reference 21.1 3.049273
9        TR       5      1      Test 67.2 4.207673
10       TR       5      2 Reference 51.5 3.941582
11       TR       6      1      Test 25.7 3.246491
12       TR       6      2 Reference 30.1 3.404525
13       RT       7      1 Reference 35.3 3.563883
14       RT       7      2      Test 26.7 3.284664
15       RT       8      1 Reference 26.0 3.258097
16       RT       8      2      Test 36.5 3.597312
17       RT       9      1 Reference 38.2 3.642836
18       RT       9      2      Test 57.8 4.056989
19       TR      10      1      Test 33.6 3.514526
20       TR      10      2 Reference 32.5 3.481240
21       TR      11      1      Test 25.1 3.222868
22       TR      11      2 Reference 36.8 3.605498
23       TR      12      1      Test 44.1 3.786460
24       TR      12      2 Reference 42.9 3.758872
25       RT      13      1 Reference 25.6 3.242592
26       RT      13      2      Test 20.1 3.000720
27       RT      14      1 Reference 58.0 4.060443
28       RT      14      2      Test 45.3 3.813307
29       RT      15      1 Reference 47.2 3.854394
30       RT      15      2      Test 51.8 3.947390
31       TR      16      1      Test 16.5 2.803360
32       TR      16      2 Reference 21.4 3.063391
33       TR      17      1      Test 47.3 3.856510
34       TR      17      2 Reference 39.4 3.673766
35       TR      18      1      Test 22.6 3.117950
36       TR      18      2 Reference 17.3 2.850707
37       RT      19      1 Reference 17.5 2.862201
38       RT      19      2      Test 30.1 3.404525
39       RT      20      1 Reference 51.7 3.945458
40       RT      20      2      Test 36.0 3.583519
41       RT      21      1 Reference 24.5 3.198673
42       RT      21      2      Test 18.2 2.901422
43       TR      22      1      Test 36.3 3.591818
44       TR      22      2 Reference 27.2 3.303217
45       TR      23      1      Test 29.4 3.380995
46       TR      23      2 Reference 39.6 3.678829
47       TR      24      1      Test 18.3 2.906901
48       TR      24      2 Reference 20.7 3.030134

The formula method of t.test

 > result <- t.test(logAUC ~ treatment, data = resp, subset = (period == 
1), var.equal = FALSE, conf.level = 0.90)
 > result

gives

        Welch Two Sample t-test

data:  logAUC by treatment
t = 1.1123, df = 21.431, p-value = 0.2783
alternative hypothesis: true difference in means is not equal to 0
90 percent confidence interval:
 -0.0973465  0.4542311
sample estimates:
mean in group Reference      mean in group Test
               3.562273                3.383831

Now I'm interested rather in the confidence interval of "Test" - 
"Reference" rather than "Reference" - "Test" which is given by t.test

Do you know a more elegant way than the clumsy one I have tried?

 > as.numeric(exp(result$estimate[2]-result$estimate[1]))
 > as.numeric(exp(-result$conf.int[2]))
 > as.numeric(exp(-result$conf.int[1]))

Best regards,
Helmut

-- 
Ing. Helmut Schütz
BEBAC - Consultancy Services for
Bioequivalence and Bioavailability Studies
Neubaugasse 36/11
1070 Vienna, Austria
tel/fax +43 1 2311746
e-mail  helmut.schuetz at bebac.at
web     http://bebac.at
forum   http://forum.bebac.at



More information about the R-help mailing list