Odds ratios instead of logits in stargazer() LaTeX output

As per symbiotic comment in 2014, more recent versions of ''stargazer'' have the options ''apply.*'' for ''coef'' ''se'' ''t'' ''p'' and ''ci'' allowing the direct transformation of these statistics.

apply.coef a function that will be applied to the coefficients.
apply.se a function that will be applied to the standard errors.
apply.t a function that will be applied to the test statistics.
apply.p a function that will be applied to the p-values.
apply.ci a function that will be applied to the lower and upper bounds of the confidence intervals.

Meaning you can directly use...

stargazer(model, 
          apply.coef = exp,
          apply.se   = exp)

EDIT : I have noticed however that simply exponentiating the CIs does not give what you would expect.

EDIT : You can obtain the correct CIs using the method described here.


stargazer allows you to substitute a lot of things, dependent variable labels, covariate labels and so forth. To substitute those you need to supply a vector of variable labels, this is done to have publishable row names, instead of variable names from R by default.

So in order to have odds ratios, you need to supply a vector of odds ratios to stargazer. How do you obtain that vector? Very easily, actually. Let's say that your model is called model, then your code is:

coef.vector <- exp(model$coef)
stargazer(model,coef=list(coef.vector))

If you have multiple models in your table, then the list should be expanded, e.g. coef=list(coef.vector1,coef.vector2,...), where all vectors in the list would be derived from similar exponentiation as above.

Tags:

R

Latex

Stargazer