ordinal cross-classified model
Posted: Sun Jan 29, 2012 7:28 pm
I am trying to estimate a cross-classified random intercepts ordered multinomial model with common coefficients for predictor variables. Although I found no examples of such a model, I am assuming that MLwiN can run such models. (I know that MLwiN can run a cross-classified random intercepts binomial model.)
Yet I am having some problems sending the correctly specified model to MLwinN.
Starting with "xc.dta" (http://www.bristol.ac.uk/cmm/media/runmlwin/xc, clear) from "help runmwlin", I first modify "pupil" so that it is unique (apparently required for multimonial models in MLwinN).
.gen pupil2 = _n
I then generate the variables needed for the cross-classification: the pseudo-level 3 variables "s1", "s2", . . . "s19" to replace variable "sid".
.tabulate sid, generate(s)
I then generate the constraints that set the covariances of the pseudo-level 3 variables "s1", "s2", . . . "s19" equal to zero. (Note that I am using attain as an ordinal variable - there are 10 levels and, therefore, 9 contrasts.)
.local c = 1
.forvalues s=2/19 {
constraint define `c' [RP3]var(s1_123456789) = [RP3]var(s`s'_123456789)
local c = `c' + 1
}
When I run the following command . . .
. runmlwin attain cons, ///
level3(cons: (s1-s19, contrast(1/9)), diagonal) ///
level2(pid: (cons, contrast(1/9))) ///
level1(pupil2) ///
discrete( ///
distribution(multinomial) ///
link(ologit) ///
denominator(cons) ///
basecategory(10) ///
) ///
constraints(1/18)
I get the following error "detected my MLN":
"error while obeying batch file C:\~Temp\ST_0x00007.tmp at line number 100: FPAR 0 's1'
undefined explanatory variable referenced"
I suspect that my syntax for the (pseudo) level 3 is incorrect, but I can't figure out why. Thank you for any advice or help.
BP Lucas
Yet I am having some problems sending the correctly specified model to MLwinN.
Starting with "xc.dta" (http://www.bristol.ac.uk/cmm/media/runmlwin/xc, clear) from "help runmwlin", I first modify "pupil" so that it is unique (apparently required for multimonial models in MLwinN).
.gen pupil2 = _n
I then generate the variables needed for the cross-classification: the pseudo-level 3 variables "s1", "s2", . . . "s19" to replace variable "sid".
.tabulate sid, generate(s)
I then generate the constraints that set the covariances of the pseudo-level 3 variables "s1", "s2", . . . "s19" equal to zero. (Note that I am using attain as an ordinal variable - there are 10 levels and, therefore, 9 contrasts.)
.local c = 1
.forvalues s=2/19 {
constraint define `c' [RP3]var(s1_123456789) = [RP3]var(s`s'_123456789)
local c = `c' + 1
}
When I run the following command . . .
. runmlwin attain cons, ///
level3(cons: (s1-s19, contrast(1/9)), diagonal) ///
level2(pid: (cons, contrast(1/9))) ///
level1(pupil2) ///
discrete( ///
distribution(multinomial) ///
link(ologit) ///
denominator(cons) ///
basecategory(10) ///
) ///
constraints(1/18)
I get the following error "detected my MLN":
"error while obeying batch file C:\~Temp\ST_0x00007.tmp at line number 100: FPAR 0 's1'
undefined explanatory variable referenced"
I suspect that my syntax for the (pseudo) level 3 is incorrect, but I can't figure out why. Thank you for any advice or help.
BP Lucas