Dear R users,

The nnet package includes the multinom method for the confint function. 
The R Help file (?confint) for the generic function in the stats package 
and the help files for the glm and nls methods in the MASS package 
indicate that one can use the "parm" argument as "a specification of 
which parameters are to be given confidence intervals, either a vector 
of numbers or a vector of names. If missing, all parameters are 
considered." Although the confint.multinom() function in the nnet 
package accepts the "parm" argument, it doesn't appear to offer this 
functionality if there are more than two response categories. Since this 
method isn't documented, maybe I shouldn't expect it to, but there seems 
to be a simple solution. Compare:

library(MASS)

example(birthwt)

(bwt.mu <- multinom(low ~ ., bwt))

confint(bwt.mu,"age")


with

(bwt.mu2 <- multinom(race ~ ., bwt))

confint(bwt.mu2,"age")


It looks like John Fox has something going on R-Forge regarding another 
version of the confint.multinom() function 
(http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/utilities.R?rev=2&root=rcmdr 
<http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/pkg/R/utilities.R?rev=2&root=rcmdr>). 
However, with a few minor changes, the function in the nnet package 
could work as I had expected it to:

confint.mult<-function (object, parm, level = 0.95, ...) 

{

    cf <- coef(object)

    pnames <- if (is.matrix(cf)) 

        colnames(cf)

    else 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), "%")

    fac <- qnorm(a)

    if (is.matrix(cf)) {

## Ensure that ses and cf remain matrices after parameter selection.

## Otherwise they may turn into numeric vectors.

        ses <- matrix(sqrt(diag(vcov(object))), ncol = ncol(cf), 

            byrow = TRUE)[, parm, drop = FALSE]

        cf <- cf[, parm, drop = FALSE]

## Move step to create ci to after redefinition of cf.

        ci <- array(NA, dim = c(dim(cf), 2), 

        dimnames = c(dimnames(cf), 

            list(pct)))

        ci[, , 1] <- cf + ses * fac[1]

        ci[, , 2] <- cf + ses * fac[2]

        aperm(ci, c(2, 3, 1))

    }

    else {

        ci <- array(NA, dim = c(length(parm), 2), dimnames = list(pnames[parm], 

            pct))

        ses <- sqrt(diag(vcov(object)))[parm]

        ci[] <- cf[parm] + ses %o% fac

        ci

    }

}

confint.mult(bwt.mu2,"age")


Would it be possible to update the code in the nnet package? Or have I 
missed a point somewhere?

Kind regards,
-Ben Barnes

Doctoral Student
Research Group Environmental Epidemiology
German Cancer Research Center

	[[alternative HTML version deleted]]

