pairwise.t.test            package:stats            R Documentation

Pairwise t tests

Description:

     Calculate pairwise comparisons between group levels with
     corrections for multiple testing

Usage:

     pairwise.t.test(x, g, p.adjust.method = p.adjust.methods,
                     pool.sd = !paired, paired = FALSE,
                     alternative = c("two.sided", "less", "greater"),  ...)

Arguments:

       x: response vector. 

       g: grouping vector or factor. 

p.adjust.method: Method for adjusting p values (see 'p.adjust'). 

 pool.sd: switch to allow/disallow the use of a pooled SD 

  paired: a logical indicating whether you want paired t-tests. 

alternative: a character string specifying the alternative hypothesis,
          must be one of '"two.sided"' (default), '"greater"' or
          '"less"'.  

     ...: additional arguments to pass to 't.test'. 

Details:

     The 'pool.SD' switch calculates a common SD for all groups and
     used that for all comparisons (this can be useful if some groups
     are small). This method does not actually call 't.test', so extra
     arguments are ignored. Pooling does not generalize to paired tests
     so 'pool.SD' and 'paired' cannot both be 'TRUE'.

     Only the lower triangle of the matrix of possible comparisons is
     being calculated, so setting 'alternative' to anything other than
     '"two.sided"' requires that the levels of 'g' are ordered
     sensibly.

Value:

     Object of class '"pairwise.htest"'

See Also:

     't.test', 'p.adjust'

Examples:

     attach(airquality)
     Month <- factor(Month, labels = month.abb[5:9])
     pairwise.t.test(Ozone, Month)
     pairwise.t.test(Ozone, Month, p.adj = "bonf")
     pairwise.t.test(Ozone, Month, pool.sd = FALSE)
     detach()

