Skip to content

Commit 23431bf

Browse files
author
pd
committed
confint.default: re-fix case of unnamed vcov, without breaking other cases this time....
git-svn-id: https://svn.r-project.org/R/trunk@88811 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 1d3f854 commit 23431bf

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/library/stats/R/confint.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,18 @@ confint.default <- function (object, parm, level = 0.95, ...)
164164
pnames <- names(cf)
165165
if(missing(parm)) parm <- pnames
166166
else if(is.numeric(parm)) parm <- pnames[parm]
167-
parm_num <- match(parm, pnames) # in case names are missing from vcov
167+
V <- vcov(object)
168+
### Fixup for cases where V is not named
169+
### Will break if dimensions don't match between cf and V,
170+
### but without names, you can't really tell how things line up
171+
if (is.null(dimnames(V))) dimnames(V) <- list(pnames,pnames)
168172
a <- (1 - level)/2
169173
a <- c(a, 1 - a)
170174
pct <- .format_perc(a, 3)
171175
fac <- qnorm(a)
172176
ci <- array(NA, dim = c(length(parm), 2L),
173177
dimnames = list(parm, pct))
174-
ses <- sqrt(diag(vcov(object)))[parm_num]
178+
ses <- sqrt(diag(V))[parm]
175179
ci[] <- cf[parm] + ses %o% fac
176180
ci
177181
}

0 commit comments

Comments
 (0)