To replace log-odds by odds-ratios, you can do this:
library("texreg")
logit <- glm(formula = am ~ cyl,
data = mtcars,
family = binomial(link = "logit"))
screenreg(logit, override.coef = exp(coef(logit)))
The override.coef
argument just replaces the coefficients by a vector you provide. There are similar arguments for standard errors, p-values etc., in case you need them.
The result:
=========================
Model 1
-------------------------
(Intercept) 43.71 *
(1.55)
cyl 0.50 **
(0.25)
-------------------------
AIC 37.95
BIC 40.88
Log Likelihood -16.98
Deviance 33.95
Num. obs. 32
=========================
*** p < 0.001; ** p < 0.01; * p < 0.05
Note that the standard errors were not converted in the example above. It would not really make sense to convert them in the first place because they would need to be asymmetric. So you might as well drop them from the table. You can do this by saving the results into an intermediate texreg
object, manipulating this object, and then handing it over to the screenreg
function, as follows:
tr <- extract(logit)
tr@coef <- exp(tr@coef)
tr@se <- numeric()
screenreg(tr)
Result:
=========================
Model 1
-------------------------
(Intercept) 43.71 *
cyl 0.50 **
-------------------------
AIC 37.95
BIC 40.88
Log Likelihood -16.98
Deviance 33.95
Num. obs. 32
=========================
*** p < 0.001; ** p < 0.01; * p < 0.05