
R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> library("multcomp")
Loading required package: mvtnorm
Loading required package: survival
Loading required package: TH.data
Loading required package: MASS

Attaching package: 'TH.data'

The following object is masked from 'package:MASS':

    geyser

> 
> set.seed(290875)
> 
> data("warpbreaks")
> fm1 <- aov(breaks ~ wool + tension, data = warpbreaks)
> 
> TukeyHSD(fm1, "tension", ordered = FALSE)
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = breaks ~ wool + tension, data = warpbreaks)

$tension
          diff       lwr        upr     p adj
M-L -10.000000 -19.35342 -0.6465793 0.0336262
H-L -14.722222 -24.07564 -5.3688015 0.0011218
H-M  -4.722222 -14.07564  4.6311985 0.4474210

> confint(glht(fm1, linfct = mcp(tension = "Tukey")))

	 Simultaneous Confidence Intervals

Multiple Comparisons of Means: Tukey Contrasts


Fit: aov(formula = breaks ~ wool + tension, data = warpbreaks)

Quantile = 2.4156
95% family-wise confidence level
 

Linear Hypotheses:
           Estimate lwr      upr     
M - L == 0 -10.0000 -19.3542  -0.6458
H - L == 0 -14.7222 -24.0764  -5.3681
H - M == 0  -4.7222 -14.0764   4.6319

> summary(glht(fm1, linfct = mcp(tension = "Tukey")))

	 Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Tukey Contrasts


Fit: aov(formula = breaks ~ wool + tension, data = warpbreaks)

Linear Hypotheses:
           Estimate Std. Error t value Pr(>|t|)   
M - L == 0  -10.000      3.872  -2.582  0.03369 * 
H - L == 0  -14.722      3.872  -3.802  0.00105 **
H - M == 0   -4.722      3.872  -1.219  0.44740   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)

> 
> TukeyHSD(fm1, "wool", ordered = FALSE)
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = breaks ~ wool + tension, data = warpbreaks)

$wool
         diff       lwr       upr     p adj
B-A -5.777778 -12.12841 0.5728505 0.0736137

> confint(glht(fm1, linfct = mcp(wool = "Tukey")))

	 Simultaneous Confidence Intervals

Multiple Comparisons of Means: Tukey Contrasts


Fit: aov(formula = breaks ~ wool + tension, data = warpbreaks)

Quantile = 2.0086
95% family-wise confidence level
 

Linear Hypotheses:
           Estimate lwr      upr     
B - A == 0  -5.7778 -12.1284   0.5729

> summary(glht(fm1, linfct = mcp(wool = "Tukey")))

	 Simultaneous Tests for General Linear Hypotheses

Multiple Comparisons of Means: Tukey Contrasts


Fit: aov(formula = breaks ~ wool + tension, data = warpbreaks)

Linear Hypotheses:
           Estimate Std. Error t value Pr(>|t|)  
B - A == 0   -5.778      3.162  -1.827   0.0736 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)

> 
> proc.time()
   user  system elapsed 
  0.364   0.012   0.373 
