comp.intercepts {NCStats}R Documentation

Tests for significant differences among all pairs of intercepts in an IVR.

Description

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

Usage

comp.intercepts(mdl, common.cov = mean(x), alpha = 0.05,...)

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

Arguments

mdl a lm object.
common.cov a value to be used as the common value of the covariate in the adjustment process. See details.
alpha a decimal numeric indicating the desired level for the experimentwise error rate
x A CompInts object (i.e., returns from comp.intercepts).
... Other arguments to be passed to the TukeyHSD or print functions.

Details

In an indicator variable regression without the interaction(s) between the covariate (x) and indicator variable(s) (i.e., parallel lines) the coefficient on the indicator variables tests for a difference in interceps between the level of the indicator variable and the reference level. Thus, all indicator variables from a particular linear model fit only compare intercepts with the reference level. Other intercept comparisons can be found by changing the reference level but this requires re-fitting the model. Alternatively, Tukey's HSD method of multiple comparisons can 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 the required adjustment the TukeyHSD function is inappropriate for testing for difference in intercepts in an indicator 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 group factor in the original IVR, 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.

Value

A list with four components – (1) The comparison results as returned from the TukeyHSD function; (2) The value of the common covariate sent in common.cov; (3) A vector of values of the resonse 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); and (4) A vector of mean adjusted values at the value of the common covariate.
The print function prints the comparison and adjusted means in a nice format.

Author(s)

Derek H. Ogle, dogle@northland.edu; relies on the TukeyHSD of the Stats package.

See Also

TukeyHSD and fit.plot.

Examples

data(Mirex)
Mirex <- Mirex[Mirex$year!="1996" & Mirex$year!="1999",]
Mirex$year <- factor(Mirex$year)
attach(Mirex)
lm1 <- lm(mirex~weight+year)
fit.plot(lm1)
comp.intercepts(lm1)
res <- comp.intercepts(lm1,common.cov=mean(weight))
tapply(res$adjvals,year,summary)   # summary of adjusted values for each year
detach(Mirex)

[Package NCStats version 0.0-12 Index]