Announcement

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

  • Errors using random slope on dummy variable

    Hello,
    Thank you for reading my post. I am seeking advice about the following problem:

    I am estimating a model with the melogit command and I am encountering an error. The issue arises when I specify a random slope on a dummy variable that does not vary within groups (only across groups). Stata produces a "." for the confidence intervals on the variance of the dummy variable in my random effects equation. When I attempt a likelihood ratio test of the random slope/random intercept model against a simpler random intercept model, Stata cannot compute the test.

    Can anyone tell me why this is happening? Is it not possible to specify a random slope on a dummy variable that does not vary within groups? (For context, the variable represents the ideology of a political organization, which does not change over the life of the group, only across different groups.)

    A simplified version of the model and output are below. x3 is the dummy variable in question.


    Command entered:

    melogit dep_var x1 x2 x3 ... xn || group_var: x3 , difficult

    Result:

    Mixed-effects logistic regression Number of obs = 9,403
    Group variable: group_var Number of groups = 111

    Obs per group:
    min = 1
    avg = 70.3
    max = 1,602

    Integration method: mvaghermite Integration pts. = 7

    Wald chi2(16) = 122.15
    Log likelihood = -1429.8005 Prob > chi2 = 0.0000
    ----------------------------------------------------------------------------------
    dep_var | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -----------------+----------------------------------------------------------------
    x1 | -.9199624 .2245428 -4.10 0.000 -1.360058 -.4798666
    x2 | .2273233 .258696 0.88 0.380 -.2797115 .7343581
    x3 | -.4584869 .2303522 -1.99 0.047 -.9099688 -.0070049

    [some variables not shown]

    xn | 3.570397 .5860844 6.09 0.000 2.421693 4.719101
    _cons | -5.265287 .7204782 -7.31 0.000 -6.677399 -3.853176
    -----------------+----------------------------------------------------------------
    group-var |
    var(x3) | 1.28e-28 1.96e-14 . .
    var(_cons)| 2.575771 .6452784 1.576396 4.20871
    ---------------------------------------------------------------------------------
    LR test vs. logistic model: chibar2(01) = 424.62 Prob >= chibar2 = 0.0000

  • #2
    No, it is not possible.

    Think of it this way. Although it is not exactly a correct analysis, you are more or less asking Stata to calculate the slope of dep_var on x3 in each group defined by group_var and then calculate the variance of those slopes. But since x3 does not vary within any such group, the slope of dep_var on x3 is actually undefined within each group. (If you regressed dep_var on x3 separately within each group using -logit-, x3 would be dropped from the model due to colinearity because it is a constant.) So x3 provides no information at all about dep_var within groups. Notice also that the actual output you are seeing gives both the variance estimate and its standard error as, for practical purposes, 0. The numbers you see there are just as close to 0 as the iterative approximation gets before it terminates: there is no variation in group_var-specific dep_var:x3 slopes, as all of those slopes are, depending on how you look at it, either undefined or 0.

    Comment


    • #3
      Thank you, Clyde. This is very helpful. I understand now why I am getting this output, and I can adjust my model accordingly. I appreciate you taking the time to read my post and respond.

      Best wishes,
      Joe

      Comment

      Working...
      X