compIntercepts {FSA}R Documentation

Tests for significant differences among all pairs of intercepts in a dummy variable regression.


Tests for significant differences among all pairs of intercepts in a dummy variable regression where the dummy variables all stem from one factor.


compIntercepts(mdl, common.cov = mean(x), conf.level = 0.95,
  digits = getOption("digits"), ...)

## S3 method for class 'compIntercepts'
print(x, ...)



A lm object.


A value to be used as the common value of the covariate in the adjustment process. See details.


A single number that represents the level of confidence to use for constructing confidence intervals.


A numeric that controls the number of digits to print.


Other arguments to be passed to the TukeyHSD or print functions.


A compIntercepts object (i.e., returned from compIntercepts).


In a dummy variable regression without the interaction(s) between the covariate (x) and the dummy variable(s) (i.e., parallel lines) the coefficient for the dummy variables tests for a difference in intercepts between the level of the dummy variable and the reference level. Thus, all dummy variables from a particular linear model fit only compare intercepts with the reference level. Other intercept comparisons may be found by changing the reference level, which requires refitting the model.

Alternatively, Tukey's HSD method of multiple comparisons may be used, but this requires adjusting the original observations as if the original observations were all collected at the exact same value of the covariate (x). Because of this required adjustment, the TukeyHSD function is inappropriate for testing for difference in intercepts in a dummy variable regression.

This function provides a statistical comparison of all pairs of intercepts by first adjusting the observed data to a common value of the covariate (common.cov), computing a one-way ANOVA to determine if the mean adjusted values differ by level of the group factor in the original dummy variable regression, and then submitting the one-way ANOVA results to the TukeyHSD function to determine for which levels the mean adjusted values differ. The levels for which the mean adjusted values differ are also the levels for which the intercepts differ.

The default is to compute the adjusted values at the mean value of the covariate (i.e., common.cov=mean(x). However, if interest is in the intercepts (i.e., at X=0) then common.cov=0 should be used instead.


A list with the following four components:

comparison The comparison results as returned from TukeyHSD.
common.cov The value of the common covariate sent in common.cov.
adjvals A vector of values of the response variable adjusted to the common.cov value of the covariate. This vector can be appended to the original data frame to construct summary statistics for the adjusted values (e.g., mean adjusted value for each group).
means A vector of mean adjusted values at the value of the common covariate.
digits The value sent in digits.
rnm The name of the response (LHS) variable.
cnm The name of the covariate variable.

The print function prints the comparison and adjusted means in a nice format.


Derek H. Ogle,

See Also

TukeyHSD and compSlopes from FSA.


## Reduce Mirex data to years where slopes don't differ to
##   illustrate this function ... see compSlopes() for
##   analysis of full data set. 
Mirex <- Mirex[Mirex$year!="1996" & Mirex$year!="1999",]
Mirex$year <- factor(Mirex$year)
## Fit DVR, see that slopes don't differ, 
##   compare intercepts, visualize results
lm1 <- lm(mirex~weight*year,data=Mirex)
## Fit model without interaction to avoid warning, but
##   note that the compIntercepts() results are the same
lm2 <- lm(mirex~weight+year,data=Mirex)

[Package FSA version 0.8.18 Index]