Announcement

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

  • margins with melogit

    Hi Everyone. I'm running a random effects logit model with repeated observations nested within individuals. The random effect is at the level of the individual. I saw from Stata 14 that they now support the use of margins in postestimation with melogit. Does anyone know how the random effects are accounted for? Are they averaged? Are they assumed to have a mean of 0 and ignored? Any info would be great!

  • #2
    I suggest that, as per Forum FAQ recommendations about posting questions, you first look at the Stata 14 Manual entry for melogit postestimation (with subsection on margins) and then also follow the cited link to meglm postestimation. Then repost a more specific question.

    Comment


    • #3
      I was not able to find an answer to this in the Stata 14 manual on documentation in melogit postestimation, meglm postestimation, or margins. I'm curious whether the output produced by margins assumes an average random intercept, or a random intercept of 0. For example, I am predicting whether an individual engages in binge drinking by age, with four reports of binge drinking for each individual.


      melogit binge age, vce(cluster region) || aid: , pweight(gswgt145)

      Fitting fixed-effects model:

      Iteration 0: log likelihood = -16158338
      Iteration 1: log likelihood = -16117413
      Iteration 2: log likelihood = -16117383
      Iteration 3: log likelihood = -16117383

      Refining starting values:

      Grid node 0: log likelihood = -15310705

      Fitting full model:

      Iteration 0: log pseudolikelihood = -15310705
      Iteration 1: log pseudolikelihood = -15171175
      Iteration 2: log pseudolikelihood = -15164414
      Iteration 3: log pseudolikelihood = -15164379
      Iteration 4: log pseudolikelihood = -15164379

      Mixed-effects logistic regression Number of obs = 10,592
      Group variable: aid Number of groups = 2,648

      Obs per group:
      min = 4
      avg = 4.0
      max = 4

      Integration method: mvaghermite Integration pts. = 7

      Wald chi2(1) = 44.49
      Log pseudolikelihood = -15164379 Prob > chi2 = 0.0000
      (Std. Err. adjusted for 4 clusters in region)
      ------------------------------------------------------------------------------
      | Robust
      binge | Coef. Std. Err. z P>|z| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      age | .0158337 .002374 6.67 0.000 .0111808 .0204866
      _cons | -1.526124 .2176829 -7.01 0.000 -1.952774 -1.099473
      -------------+----------------------------------------------------------------
      aid |
      var(_cons)| 2.011161 .1055228 1.814619 2.22899
      ------------------------------------------------------------------------------

      . margins, at(age=(15(5)40))

      Adjusted predictions Number of obs = 10,592
      Model VCE : Robust

      Expression : Marginal predicted mean, predict()

      1._at : age = 15

      2._at : age = 20

      3._at : age = 25

      4._at : age = 30

      5._at : age = 35

      6._at : age = 40

      ------------------------------------------------------------------------------
      | Delta-method
      | Margin Std. Err. z P>|z| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      _at |
      1 | .2799136 .0290235 9.64 0.000 .2230287 .3367986
      2 | .2919709 .0279582 10.44 0.000 .2371738 .346768
      3 | .3042835 .0268333 11.34 0.000 .2516911 .3568758
      4 | .3168411 .0256602 12.35 0.000 .2665479 .3671343
      5 | .3296327 .0244532 13.48 0.000 .2817054 .3775601
      6 | .3426462 .0232293 14.75 0.000 .2971175 .3881749
      ------------------------------------------------------------------------------



      The predicted probability of binge drinking at 15 calculated ignoring the random effect is exp(-1.526124+(15*.0158337) =.2756. This is lower than what is produced by margins (.2799) which makes me suspect that margins is somehow including the random effect.

      Any thoughts are appreciated!

      Comment


      • #4
        -margins- is a wrapper for -predict-. Whenever you run -margins-, it produces results in the metric of its -predict()- option. If you don't specify a -predict()- option to -margins-, you get results in the metric of the default parameter of the -predict- command. In the case of -melogit-, the default option of the -predict- command is mu. (You can find this by running -help melogit postestimation- and then clicking on the blue link for predict.) The definition of mu is the predicted value of the response (outcome) variable--in this case, binge. So it includes everything: the sum of products of coefficients and predictor variables plus the random effects, and all then translated to the probability metric by applying the -invlogit()- function. To get this in the log-odds metric (i.e. without the -invlogit()- transformation), you would have to issue the command as -margins, at(age = (15(5)40)) predict(eta)-. And if you wanted to exclude the random effects from that you would have to write the command as -margins, at(age = (15(5)40)) predict(xb)-.

        This is a common cause of confusion. With simple linear regression, it is very easy because basically the only output to work with is xb. (Or, otherwise put, xb = eta = mu.) But with multilevel general linear models one might be interested in any of those three. Fortunately, you can always explicitly specify which one you want with the -predict()- option of -margins-. (And you can get still other things with the -expression()- option.) The confusion arises when you don't specify -predict()- in the -margins- command: Stata has a default response for this, but it is different for different commands. Since most of us aren't going to remember the defaults for all the many estimation commands in Stata, the safest bet is to be explicit, or to check what the default is by running -help estimation_command postestimation- and clicking on the blue predict link to find out.

        Comment

        Working...
        X