How do I add confidence intervals to odds ratios in stargazer table?

前端 未结 2 2026
你的背包
你的背包 2020-12-09 13:43

I am trying to create a table of a multivariable logistic regression model using stargazer. I would like to include odds ratios and their confidence int

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 14:24

    You can use the ci.custom argument to feed stargazer a list with custom confidence intervals (first column is the lower bound, second column is the upper bound). In your example, all you have to do is call:

    stargazer(mylogit, coef = list(OR.vector), ci = T, 
    ci.custom = list(CI.vector), single.row = T, type = "text")
    

    Alternatively, you can define your own function to exponentiate values and simply apply this function to your coefficients and/or confidence intervals (using arguments apply.coef and apply.ci):

    exponentiate <- function(x) exp(x)
    
    stargazer(mylogit, ci=T, apply.coef=exponentiate, apply.ci=exponentiate, 
    single.row = T, type="text")
    

提交回复
热议问题