Next: quadmax() Up: Design Macros Help File Previous: mixed()   Contents


pairwise(factorname,lev [,method:T] [,error:term]), CHARACTER scalar
  factorname, positive REAL scalar lev < 1, positive integer or
  CHARACTER scalar term, keyword phrase method:T one of 'lsd:T',
  'bsd:T', 'snk:T', 'hsd:T', 'regwb:T', or 'regwr:T'
pairwise(factorname,critval:val), positive REAL scalar val

Keywords: ANOVA, analysis
pairwise(factorname,siglevel) prints a summary of all paired comparisons
between the levels of the factor given in factorname at the level of
significance siglevel.  Comparisons are done using the Bonferroni
method.  factorname must be a CHARACTER scalar or quoted string naming a
factor in the current GLM model and siglevel must be a REAL scalar
between 0 and 1.  It is an error if there is no current GLM model or if
the current GLM model does not contain the named factor.

pairwise(factorname,siglevel,METHOD:T), where METHOD:T is one of
'bsd:T', 'lsd:T', 'snk:T', 'hsd:T', 'regwb:T', or 'regwr:T', does the
same, except METHOD specifies the multiple comparison method to be used.
  METHOD       Description
   bsd         Bonferroni method (the default)
   lsd         Least significant difference method
   hsd         Tukey's honestly significant difference or Studentized
               range method
   snk         Student-Newman-Keuls method
   regwb       Step down Bonferroni using REGW tail probabilities
   regwrs      Step down Studentized range using REGW tail probabilities.

The REGW tail probabilities were proposed in papers by Ryan, Einot and
Gabriel, and Welsch.

pairwise(factorname,critval:val) does the same, except it uses val as
the critical value for a t-test between the levels of factorname rather
than a computed cutoff.

After anova("y=trt"),
  Cmd> pairwise("trt",.01,hsd:T)
does paired comparisons between the levels of trt at signficance .01
using the HSD method.

  Cmd> pairwise("trt",\
         critval:invstudrng("trt",1 - .01, max(trt), DF[3])/sqrt(2))
does the same, directly computing the HSD critical value.  See

pairwise() prints only a summary of the results and returns no value.  The
printed output consists of one row for each level of the term, sorted
from smallest to largest effect, giving the "underlines" identifying
effects that are not significantly different, level number, and effect.

By default, the error mean square used in the comparison tests is taken
from the last error term of the current model (the last line of the
ANOVA table).  You may specify a different error term with keyword
phrase error:term.  term must be a CHARACTER scalar or positive integer
which specifies the name or number of the line in the ANOVA table to be
used as the error mean square.  Examples are 'error:4' (use line 4 as
error term) or 'error:"a.b.c"' (use the ABC interaction as error term).

The contrast() command is used to make each comparison.  In particular
this implies that the comparisons are adjusted for any other terms in
the model and that there should be no missing degrees of freedom in the

  Cmd> anova("y=a")
  Model used is y=a
                  DF           SS           MS
  CONSTANT         1       15.082       15.082
  a                4       67.535       16.884
  ERROR1          15       20.132       1.3421

  Cmd> pairwise("a",.05,hsd:T) #hsd method
    |        5    -1.86
    | |      2    -1.18
    | |      4    -1.15
      | |    3     1.13
        |    1     3.07

  Cmd> pairwise("a",.05,lsd:T) #lsd w/ alpha=.05
    |    5    -1.86
    |    2    -1.18
    |    4    -1.15
         3     1.13
         1     3.07

  Cmd> pairwise("a",critval:2.13) #lsd w/ alpha=.05 a different way
    |    5    -1.86
    |    2    -1.18
    |    4    -1.15
         3     1.13
         1     3.07

Gary Oehlert 2003-01-15