### Some Tukey Kramer Examples

. use http://www.ats.ucla.edu/stat/data/hsbdemo, clear
(highschool and beyond (200 cases))

. anova write prog##female

Number of obs =     200     R-squared     =  0.2590
Root MSE      = 8.26386     Adj R-squared =  0.2399

Source |  Partial SS    df       MS           F     Prob > F
------------+----------------------------------------------------
Model |  4630.36091     5  926.072182      13.56     0.0000
|
prog |  3274.35082     2  1637.17541      23.97     0.0000
female |  1261.85329     1  1261.85329      18.48     0.0000
prog#female |  325.958189     2  162.979094       2.39     0.0946
|
Residual |  13248.5141   194  68.2913097
------------+----------------------------------------------------
Total |   17878.875   199   89.843593

. tukeykramer prog

Tukey-Kramer pairwise comparisons for variable prog
studentized range critical value(.05, 3, 194) = 3.3402131

abs
grp (n) vs grp (n)           group means           dif     TK-test
------------------------------------------------------------------
1 (45) vs 2 (105)         51.1964    56.1016      4.9052   4.7113*
1 (45) vs 3 (50)          51.1964    46.3945      4.8019   3.9992*
2 (105) vs 3 (50)         56.1016    46.3945      9.7071   9.6680*

Number of obs =     200     R-squared     =  0.4889
Root MSE      = 6.88105     Adj R-squared =  0.4730

Source |  Partial SS    df       MS           F     Prob > F
------------+----------------------------------------------------
Model |  8740.54801     6    1456.758      30.77     0.0000
|
prog |  632.133455     2  316.066727       6.68     0.0016
female |  1680.08743     1  1680.08743      35.48     0.0000
prog#female |  301.770797     2  150.885399       3.19     0.0435
read |  4110.18709     1  4110.18709      86.81     0.0000
|
Residual |  9138.32699   193  47.3488445
------------+----------------------------------------------------
Total |   17878.875   199   89.843593

. tukeykramer prog

Tukey-Kramer pairwise comparisons for variable prog
studentized range critical value(.05, 3, 193) = 3.3403471

abs
grp (n) vs grp (n)           group means           dif     TK-test
------------------------------------------------------------------
1 (45) vs 2 (105)         52.3220    54.1506      1.8286   2.1093
1 (45) vs 3 (50)          52.3220    49.3984      2.9236   2.9242
2 (105) vs 3 (50)         54.1506    49.3984      4.7522   5.6842*

Source |       SS       df       MS              Number of obs =     200
-------------+------------------------------           F(  6,   193) =   30.77
Model |  8740.54801     6    1456.758           Prob > F      =  0.0000
Residual |  9138.32699   193  47.3488445           R-squared     =  0.4889
Total |   17878.875   199   89.843593           Root MSE      =   6.881

------------------------------------------------------------------------------
write |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
prog |
2  |   3.829251   1.814745     2.11   0.036     .2499723     7.40853
3  |  -3.704427   2.112741    -1.75   0.081    -7.871453    .4625998
|
1.female |   7.073163   2.080605     3.40   0.001     2.969519    11.17681
|
prog#female |
2 1  |  -4.001236   2.479073    -1.61   0.108    -8.890789    .8883175
3 1  |   1.561714   2.859796     0.55   0.586    -4.078752    7.202181
|
read |   .4948275   .0531102     9.32   0.000     .3900767    .5995784
_cons |   22.94056   3.188071     7.20   0.000     16.65263    29.22849
------------------------------------------------------------------------------

. tukeykramer prog

Tukey-Kramer pairwise comparisons for variable prog
studentized range critical value(.05, 3, 193) = 3.3403471

abs
grp (n) vs grp (n)           group means           dif     TK-test
------------------------------------------------------------------
1 (45) vs 2 (105)         52.3220    54.1506      1.8286   2.1093
1 (45) vs 3 (50)          52.3220    49.3984      2.9236   2.9242
2 (105) vs 3 (50)         54.1506    49.3984      4.7522   5.6842*

Source |       SS       df       MS              Number of obs =     200
-------------+------------------------------           F(  6,   193) =   30.77
Model |  8740.54801     6    1456.758           Prob > F      =  0.0000
Residual |  9138.32699   193  47.3488445           R-squared     =  0.4889
Total |   17878.875   199   89.843593           Root MSE      =   6.881

------------------------------------------------------------------------------
write |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
prog |
2  |   3.829251   1.814745     2.11   0.036     .2499723     7.40853
3  |  -3.704427   2.112741    -1.75   0.081    -7.871453    .4625998
|
1.female |   7.073163   2.080605     3.40   0.001     2.969519    11.17681
|
prog#female |
2 1  |  -4.001236   2.479073    -1.61   0.108    -8.890789    .8883175
3 1  |   1.561714   2.859796     0.55   0.586    -4.078752    7.202181
|
read |   .4948275   .0531102     9.32   0.000     .3900767    .5995784
_cons |   22.94056   3.188071     7.20   0.000     16.65263    29.22849
------------------------------------------------------------------------------

. tukeykramer prog, df(2) mse(162.9)

Tukey-Kramer pairwise comparisons for variable prog
studentized range critical value(.05, 3, 2) = 8.3267903

abs
grp (n) vs grp (n)           group means           dif     TK-test
------------------------------------------------------------------
1 (45) vs 2 (105)         52.3220    54.1506      1.8286   1.1372
1 (45) vs 3 (50)          52.3220    49.3984      2.9236   1.5765
2 (105) vs 3 (50)         54.1506    49.3984      4.7522   3.0645



The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.