Search code examples
rlogistic-regressionstargazer

Stargazer for reporting odds ratios in logit report wrong significance stars


I am running a logistic regression and reporting the results with stargazer. I've noticed that when I apply the apply.coef = OR option (so that the odds ratios would be reported), the significance stars are reported wrongly - in some cases there is no stars instead of three, sometimes there are stars when there shouldn't be. For example;

stargazer(basic.logit.model, 
      type="html",
      apply.coef = OR,
      column.labels = c("Base"),
      dep.var.labels.include = FALSE,
      digits=2, out=("basic_model_only.htm"))

yields

X   0.33
(0.23)
Constant    0.03
(0.11)
Observations    6,532
Log Likelihood  -552.64
Akaike Inf. Crit.   1,109.28
Note:   *p<0.1; **p<0.05; ***p<0.01

and without the apply-coef option, the results are:

X  -1.10***
(0.23)
Constant    -3.68***
(0.11)
Observations    6,532
Log Likelihood  -552.64
Akaike Inf. Crit.   1,109.28
Note:   *p<0.1; **p<0.05; ***p<0.01

what am I missing?


Solution

  • generally you should strive to provide a minimal working example so we can reproduce your results - in this case it would be great to have data and the code you use to produce your basic.logit.model.

    To your question, apply.coef only transforms your coefficients but not the standard errors as your results show. stargazer calculates the significance level using these untransformed SEs which results in non-significant coefficients.

    To avoid this, provide stargazer with the custom p-values (those from the original model) using the p argument.

    This should work for you

    p.values <- list(summary(basic.logit.model)$coefficients[,4]
    
    stargazer(basic.logit.model, 
      type="html",
      apply.coef = OR,
      p = p.values,
      column.labels = c("Base"),
      dep.var.labels.include = FALSE,
      digits=2, out=("basic_model_only.htm"))