Multilinear logistic regression returns a matrix of coefficients using the coef() function. This is different from the lm or glm , which returns a vector of coefficients.
library(foreign) # read.dta() library(nnet) # multinom() require(boot) # boot() # an example for multinomial logistic regression ml = read.dta('http://www.ats.ucla.edu/stat/data/hsbdemo.dta') ml = ml[,c(5,7,3)] names(ml) bs <- function(formula, data, indices) { d = data[indices,] # allows boot to select sample fit = multinom(formula, data=d, maxit=1000, trace=FALSE) #s = summary(fit) #return(list(fit$coefficients, fit$standard.errors)) estimates <- coef(fit) return(t(estimates)) } # enable parallel library(parallel) cl <- makeCluster(2) clusterExport(cl, "multinom") # 10000 replications set.seed(1984) results <- boot( data=ml, statistic=bs, R=10000, parallel = "snow", ncpus=2, cl=cl, formula=prog~write ) # label the estimates subModelNames <- colnames(results$t0) varNames <- rownames(results$t0) results$t0 estNames <- apply(expand.grid(varNames,subModelNames),1,function(x) paste(x,collapse="_")) estNames colnames(results$t) <- estNames # summary of results library(car) summary(results) confint(results, level=0.95, type="norm") confint(results, level=0.95, type="perc") confint(results, level=0.95, type="bca") # plot the results hist(results, legend="separate")
source share