glht-methods            package:multcomp            R Documentation

_M_e_t_h_o_d_s _f_o_r _G_e_n_e_r_a_l _L_i_n_e_a_r _H_y_p_o_t_h_e_s_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Simultaneous tests and confidence intervals for general linear 
     hypotheses.

_U_s_a_g_e:

     ## S3 method for class 'glht':
     summary(object, test = adjusted(), ...)
     ## S3 method for class 'glht':
     confint(object, parm, level = 0.95, calpha = adjusted_calpha(), 
             ...)
     ## S3 method for class 'glht':
     coef(object, rhs = FALSE, ...)
     ## S3 method for class 'glht':
     vcov(object, ...)
     ## S3 method for class 'confint.glht':
     plot(x, xlim, xlab, ...)
     ## S3 method for class 'glht':
     plot(x, ...)
     univariate()
     adjusted(type = c("single-step", "Shaffer", "Westfall", "free", 
              p.adjust.methods), ...)
     Ftest()
     Chisqtest()
     adjusted_calpha(...)
     univariate_calpha(...)

_A_r_g_u_m_e_n_t_s:

  object: an object of class 'glht'.

    test: a function for computing p values.

    parm: additional parameters, currently ignored.

   level: the confidence level required.

  calpha: either a function computing the critical value or the
          critical value itself.

     rhs: logical, indicating whether the linear function K hat{theta}
          or the right hand side  m ('rhs = TRUE') of the linear
          hypothesis should be returned.

    type: the multiplicity adjustment ('adjusted')  to be applied. See
          below and 'p.adjust'.

       x: an object of class 'glht' or 'confint.glht'.

    xlim: the 'x' limits '(x1, x2)' of the plot.

    xlab: a label for the 'x' axis.

     ...: additional arguments, such as 'maxpts',  'abseps' or 'releps'
          to 'pmvnorm' in 'adjusted' or  'qmvnorm' in 'confint'. Note
          that additional arguments specified to 'summary', 'confint',
          'coef' and 'vcov' methods are currently ignored.

_D_e_t_a_i_l_s:

     The methods for general linear hypotheses as described by objects
     returned by 'glht' can be used to actually test the global null
     hypothesis, each of the partial hypotheses and for simultaneous
     confidence intervals for the linear function $K \theta$.

     The 'coef' and 'vcov' methods compute the linear function $K
     \hat{\theta}$ and its covariance, respectively.

     The 'test' argument to 'summary' takes a function specifying the
     type of test to be applied. Classical Chisq (Wald test) or F
     statistics for testing the global hypothesis $H_0$ are implemented
     in functions 'Chisqtest' and 'Ftest'. Several approaches to
     multiplicity adjusted p  values for each of the linear hypotheses
     are implemented  in function 'adjusted'. The 'type' argument to
     'adjusted' specifies the method to be applied: '"single-step"'
     implements adjusted p values based on the joint normal or $t$
     distribution of the linear function, and '"Shaffer"' and
     '"Westfall"' implement logically constraint  multiplicity
     adjustments (Shaffer, 1986; Westfall, 1997).  '"free"' implements
     multiple testing procedures under free  combinations (Westfall et
     al, 1999). In addition, all adjustment methods implemented in
     'p.adjust' are available as well.

     Simultaneous confidence intervals for linear functions can be
     computed using method 'confint'. Univariate confidence intervals
     can be computed by specifying 'calpha = univariate_calpha()' to
     'confint'. The critical value can directly be specified as a
     scalar  to 'calpha' as well. Note that 'plot(a)' for some object
     'a' of class 'glht' is equivalent to 'plot(confint(a))'.

     All simultaneous inference procedures implemented here control the
     family-wise error rate (FWER). Multivariate normal and $t$
     distributions, the latter one only for models of  class 'lm', are
     evaluated using the procedures implemented in package 'mvtnorm'.

     A more detailed description of the underlying methodology is
     available from Hothorn et al. (2008).

_V_a_l_u_e:

     'summary' computes (adjusted) p values for general linear
     hypotheses, 'confint' computes (adjusted) confidence intervals. 
     'coef' returns estimates of the linear function $K \theta$ and
     'vcov' its covariance.

_R_e_f_e_r_e_n_c_e_s:

     Juliet P. Shaffer (1986),  Modified sequentially rejective
     multiple test procedures.  _Journal of the American Statistical
     Association_, *81*, 826-831.

     Peter H. Westfall (1997),  Multiple testing of general contrasts
     using logical constraints and correlations. _Journal of the
     American Statistical Association_, *92*, 299-306.

     P. H. Westfall, R. D. Tobias, D. Rom, R. D. Wolfinger, Y. Hochberg
     (1999). _Multiple Comparisons and Multiple Tests Using the SAS
     System_. Cary, NC: SAS Institute Inc.

     Torsten Hothorn, Frank Bretz and Peter Westfall (2008),
     Simultaneous Inference in General Parametric Models. _Biometrical
     Journal_, *50*(3) (forthcoming); See 'vignette("generalsiminf",
     package = "multcomp")'.

_E_x_a_m_p_l_e_s:

       ### set up a two-way ANOVA 
       amod <- aov(breaks ~ wool + tension, data = warpbreaks)

       ### set up all-pair comparisons for factor `tension'
       wht <- glht(amod, linfct = mcp(tension = "Tukey"))

       ### 95% simultaneous confidence intervals
       plot(print(confint(wht)))

       ### the same (for balanced designs only)
       TukeyHSD(amod, "tension")

       ### corresponding adjusted p values
       summary(wht)

       ### all means for levels of `tension'
       amod <- aov(breaks ~ tension, data = warpbreaks)
       glht(amod, linfct = matrix(c(1, 0, 0, 
                                    1, 1, 0, 
                                    1, 0, 1), byrow = TRUE, ncol = 3))

       ### confidence bands for a simple linear model, `cars' data
       plot(cars, xlab = "Speed (mph)", ylab = "Stopping distance (ft)",
            las = 1)

       ### fit linear model and add regression line to plot
       lmod <- lm(dist ~ speed, data = cars)
       abline(lmod)

       ### a grid of speeds
       speeds <- seq(from = min(cars$speed), to = max(cars$speed), 
                     length = 10)

       ### linear hypotheses: 10 selected points on the regression line != 0
       K <- cbind(1, speeds)                                                        

       ### set up linear hypotheses
       cht <- glht(lmod, linfct = K)

       ### confidence intervals, i.e., confidence bands, and add them plot
       cci <- confint(cht)
       lines(speeds, cci$confint[,"lwr"], col = "blue")
       lines(speeds, cci$confint[,"upr"], col = "blue")

       ### simultaneous p values for parameters in a Cox model
       if (require("survival") && require("MASS")) {
           data("leuk", package = "MASS")
           leuk.cox <- coxph(Surv(time) ~ ag + log(wbc), data = leuk)

           ### set up linear hypotheses
           lht <- glht(leuk.cox, linfct = diag(length(coef(leuk.cox))))

           ### adjusted p values
           print(summary(lht))
       }

