Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • -margins- after -logit- calculates wrong confidence intervals

    When I use -margins- after -logit-:
    Code:
    logit y x1 x2 x3, vce(cluster country) l(90)
    margins, at(x1=(0(5)70))
    the confidence intervals are not bound by 0-1.

    How can I correct for this issue?

  • #2
    In addition: I know of transform_margins (see here: https://stats.stackexchange.com/ques...rgins-in-stata ), but I would like to plot my results via -marginsplot- or -mcp2- - how do I get these latter commands to "grab" the newly transformed values? Sorry if this is a basic question!

    Comment


    • #3
      So, you can follow-up on your own suggestion in #2 along these lines:

      Code:
      sysuse auto, clear
      
      logit foreign price mpg
      tempfile margins_results
      
      //    CALCULATE & SAVE MARGINS IN LOG ODDS METRIC
      margins, at(mpg = (10(10)30)) predict(xb) saving(`margins_results')
      
      //    TRANSFORM MARGINS & CI'S TO PROBABILITY METRIC
      use `margins_results', clear
      foreach v of varlist _margin _ci_lb _ci_ub {
          replace `v' = invlogit(`v')
      }
      
      //    AND GRAPH
      graph twoway connect _margin _ci_lb _ci_ub _at2
      With suitable -rename-ing of variables and -graph- options you can get the plot to look the way you want it.

      The key is to get the margins for xb instead of probability, then transform with -invlogit()-. Also key here is the undocumented -saving()- option in the -margins- command.

      Comment


      • #4
        Thank you, this was really helpful. The plots seem accurate now.

        I now tried to plot the margins also of -clogit-, i.e.
        Code:
        clogit y x1 x2 x3, group(country) vce(cluster country)
        The solution that you provided for -logit- does however seem to result only in unconvincing/inaccurate plots. The predicted probability was always at 0%, with only the confidence interval seeming somewhat likely.

        I've searched for ways of plotting the margins -clogit- and tried many suggested approaches (such as various margins options [predict(pu0), dydx(*), continuous, vce(unconditional)..] and different commands altogether, such as -marginsplot-) , however, none of the plots delivered satisfactory, i.e. credible, results. What am I missing?

        Edit: In this thread: http://www.statalist.org/forums/foru...al-logit-model it is even suggested that "Since the fixed effects are not actually estimated you cannot calculate marginal effects unless you are willing to assume that the fixed effects are zero."
        What is to hold of this? This runs contrary to most suggestions that I've read, i.e. that margins can also be estimated for conditional FE models!
        Last edited by Jonas Wereld; 05 Jun 2017, 06:28.

        Comment


        • #5
          Jonas:

          Edit: In this thread: http://www.statalist.org/forums/foru...al-logit-model it is even suggested that "Since the fixed effects are not actually estimated you cannot calculate marginal effects unless you are willing to assume that the fixed effects are zero."
          What is to hold of this? This runs contrary to most suggestions that I've read, i.e. that margins can also be estimated for conditional FE models!
          Please provide full literature references supporting your statement about "most suggestions you've read".

          Also have a look at the following paper, which I think is relevant to your topic of interest:
          http://www.stata.com/meeting/uk16/sl...antos_uk16.pdf

          Comment

          Working...
          X