Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
569 views
in Technique[技术] by (71.8m points)

r - Odds ratios instead of logits in stargazer() LaTeX output

When using stargazer to create a LaTeX table on a logistic regression object the standard behaviour is to output logit-values of each model. Is it possible to get exp(logit) instead? That is, can i get the Odds-ratios instead?

In the stargazer documentation the following mentions the "Coef"-argument, but I dont understand if this can enable the exp(logits).

Coef: a list of numerical vectors that will replace the default coef?cient values for each model. Element names will be used to match coef?cients to individual covariates, and should therefore match covariate names. A NULL vector indicates that, for a given model, the default set of coef?cients should be used. By contrast, an NA vector means that all of the model’s coef?cients should be left blank.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...