You often want effect sizes and confidence intervals on the odds scale from your logistic regression models. The models in R (e.g. glm, zelig) are really useful but need a bit of work before you have something you can use in your paper. This function produces a nice output data frame.

LRoutput <- function(model) { coefs <- summary(model)$coefficients CIs <- confint(model) coefsCIs <- cbind(coefs[,1], CIs) x <- data.frame(exp(coefsCIs)) x <- format(round(x, 2), digits = 2, nsmall = 2) p <- round(coefs[,4], 3) p2 <- ifelse(p < 0.001, "<0.001", paste0(" ", format(p, digits = 3, nsmall = 3))) stars <- findInterval(p, c(0, 0.001, 0.01, 0.05, 0.1)) stars <- factor(stars, 1:5, labels = c("***", "**", "*", ".", "")) summ <- paste0(x[,1], " (", x[,2], "-", x[,3], ";", p2, ")") return(data.frame(coef = x[,1], lci = x[,2], uci = x[,3], p = p, stars = stars, summary = summ)) }

Advertisements