Announcement

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

  • Random effects with factor variable in melogit

    I'm doing an analysis on pupils nested in schools, with two major types of schools involved. In particular, I want to take into account difference in variability of pupils' decision (binary outcome variable) in those two types of schools, controlling for some additional variables, like gender.

    Introducing variable 'type' as factor, in line with the manual:
    melogit decision [indep vars] type || id: R.type
    produces only random intercept of 1.69. It is as no variable was added to the random part of equation.

    When variable 'type' (of school) is introduced as random slope:
    melogit decision [indep vars] type || id: type
    I get the coefficient of 0.00002 for the slope (practically zero when SE taken into account) and random intercept of 1.69, so roughly the same as above. And when I tried to suppress constant term, I got: "no random effects on level id found".

    Finally, I've found on this forum that one can replicate factor specification by introducing two dummies (see: http://www.statalist.org/forums/foru...cts-in-melogit, and as I wanted separate variance for two types of schools, therefore I've omitted the cov(id)), like in:
    melogit decision [indep vars] type || id: dummy1 dummy2, nocon
    and I've received two separate variance terms of 2.80 and 0.81 (and quite a change in the value of fixed effect).

    Essentially, the last result seems to make most sense, as I've expected much larger variance in one type of school than in another (and I presume I have two separate random intercepts here), but the way I obtained this result seems far from the default procedures offered by Stata. In particular, I was surprised by the fact that introducing two dummies with substantially the same information (one coded 1/0, another 0/1) brought meaningful results.

    Is my understanding of what's going on in those codes right? If so, then why R.var notation didn't work as expected?

    Regards,
    Irek

  • #2
    I didn't get any reaction, so perhaps I should rephrase the question: I'm interested not only in the average difference between types of schools, but also in difference of the variances within those types. There is good chance I've already managed to get that by specifying my model as shown in the third version of the code shown above (with dummy1 and dummy2) and getting two separate random effects.

    Now, does this make sense? In terms of model's fit - as it seems to me - the answer is positive, because I went from
    Log likelihood = -94367.215
    to
    Log likelihood = -94203.962
    by 'wasting' only one additional df. There is some change in the fixed part as well, but I can't be sure what to make of it without knowing precisely how to interpret the two random effects.

    Anyone, pls, let me know at least if my dilemma is moot or valid.

    ps. I have issues fitting type as third level (can't converge), though I've managed to get it in lme4.

    Comment

    Working...
    X