Adjusted and Unadjusted OR's with greg package

时间:2016-07-11 19:37:15

标签: r logistic-regression summary

I am trying to create a table for crude unadjusted and adjusted odds ratios. My code is as follows:

model<- glm(lead_ind ~ hseAge+ DurStayCat + 
                       gender + Region + 
                       ips_parasites, data=DfStudy2sel)

printCrudeAndAdjustedModel(model)

However, my output is a table of the betas and their confidence intervals. How can I get the ORs, 95%CI instead? Thanks

1 个答案:

答案 0 :(得分:1)

The problem is that you are not doing a logistic regression but a plain gaussian. You need to specify that you are using a binomial family, here's an example:

library(datasets)
data(mtcars)
mtcars$am <- factor(mtcars$am, labels = c("Automatic", "Manual"))
fit <- glm(am == "Automatic" ~ cyl + mpg, data = mtcars, family = binomial)

library(Greg)
# Drop the intercept column via the -1 as it is rarely used in logistic models
printCrudeAndAdjustedModel(fit)[-1,]