Hi, 

I'm trying to obtain a table of coefficients and confidence intervals from a 
logistic regression analysis in R. My code is as follows:

# read in csv file

datafile<-read.csv("file.csv", row.names=1)
# read in the variable list
varlist<-names(datafile)[66:180]
models<-lapply(varlist, function(x) {glm(substitute(outcome ~ i, 
list(i=as.name(x))), data=datafile, family = "binomial")})

# apply summary to each model stored in the list, models

lapply(models, summary)

tableofOddsRatios<-exp(cbind(OR = coef(models), confint(models)))
write.table(table, "tableofOddsRatios_outcome.txt", sep="\t", row.names=T, 
col.names=T, quote=F)

When I try to run this, I get the following error message:
> tableofOddsRatios<-exp(cbind(OR = coef(models), confint(models)))
Error in UseMethod("vcov") : 
  no applicable method for 'vcov' applied to an object of class "list"

Should I be doing this another way?
Thanks

Danielle

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to