[R] confint.lm in MASS
Giovanni Petris
GPetris at uark.edu
Fri Feb 7 00:31:02 CET 2003
I don't know if this has already come up in the list or elsewhere - a
quick search did't show anything relevant - but I think it's worth of
mention. The confint.lm function in package MASS doesn't work
correctly when called on a subset of parameters. The bug, easy to fix,
is that confidence intervals are computed for all parameters anyway,
and then assigned to a matrix which is too small for all of them (see
function body below).
As I said, I think it's worth knowing it.
Best,
Giovanni
> confint.lm
function (object, parm, level = 0.95, ...)
{
cf <- coef(object)
pnames <- names(cf)
if (missing(parm))
parm <- seq(along = pnames)
else if (is.character(parm))
parm <- match(parm, pnames, nomatch = 0)
a <- (1 - level)/2
a <- c(a, 1 - a)
pct <- paste(round(100 * a, 1), "%")
ci <- array(NA, dim = c(length(parm), 2), dimnames = list(pnames[parm],
pct))
ses <- sqrt(diag(vcov(object)))
fac <- qt(a, object$df.residual)
ci[] <- cf + ses %o% fac
ci
}
--
__________________________________________________
[ ]
[ Giovanni Petris GPetris at uark.edu ]
[ Department of Mathematical Sciences ]
[ University of Arkansas - Fayetteville, AR 72701 ]
[ Ph: (479) 575-6324, 575-8630 (fax) ]
[ http://definetti.uark.edu/~gpetris/ ]
[__________________________________________________]
More information about the R-help
mailing list