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:
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:
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:
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
Introducing variable 'type' as factor, in line with the manual:
melogit decision [indep vars] type || id: R.type
When variable 'type' (of school) is introduced as random slope:
melogit decision [indep vars] type || id: type
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
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
Comment