# glht-methods

0th

Percentile

##### Methods for General Linear Hypotheses

Simultaneous tests and confidence intervals for general linear hypotheses.

##### Usage
## S3 method for class 'glht':
## S3 method for class 'glht':
confint(object, parm, level = 0.95, ...)
## S3 method for class 'glht':
coef(object, rhs = FALSE, ...)
## S3 method for class 'glht':
vcov(object, ...)
univariate()
...)
Ftest()
Chisqtest()
##### Arguments
object
an object of class glht.
test
a function for computing p values.
parm
level
the confidence level required.
rhs
logical, indicating whether the linear function $K \hat{\beta}$ 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.
...
additional arguments, such as maxpts, abseps or releps to pmvnorm in adjusted or
##### Details

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$. The coef and vcov methods compute the linear function $K$ 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: "free" 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). 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 the additional argument adjusted = FALSE to confint.

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.

summary computes (adjusted) p values for general linear hypotheses, confint computes (adjusted) confidence intervals. coef returns estimates of the linear function $K$ and vcov its covariance. 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.

### set up a two-way ANOVA with interactions 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)

### 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)) }

htest

• summary.glht
• confint.glht
• coef.glht
• vcov.glht
• univariate