CoeffDiffCI {ModTools}R Documentation

Confidence Interval for the Difference of Two Coefficients in a Linear Model

Description

Calculate the confidence interval for the difference of two coefficients in a linear model.

Usage

CoeffDiffCI(x, coeff, conf.level = 0.95, sides = c("two.sided", "left", "right"))

Arguments

x

the linear model object

coeff

a vector of length two, containing either the names or the index of the two coefficients whose difference should be used

conf.level

confidence level of the interval.

sides

a character string specifying the side of the confidence interval, must be one of "two.sided" (default), "left" or "right". You can specify just the initial letter. "left" would be analogue to a hypothesis of "greater" in a t.test.

Details

This is quite useful in the course of the modelling process.

Value

a numeric vector with 3 elements:

mean

mean

lwr.ci

lower bound of the confidence interval

upr.ci

upper bound of the confidence interval

Author(s)

Andri Signorell <andri@signorell.net>

See Also

linearHypothesis()

Examples

# get some model first...
r.lm <- FitMod(Fertility ~ ., data=swiss, fitfn="lm")

# calculate the confidence interval for the difference of the
# coefficients Examination and Education
CoeffDiffCI(r.lm, c("Examination", "Education"))

# the test could be calculated as
car::linearHypothesis(r.lm, "Education = Examination")

[Package ModTools version 0.9.6 Index]