With that number of students and some reasonable number of schools, convergence shouldn't take forever with mixed under most circumstances, but if you're growing impatient, then consider going with the equivalent SEM, as Erik and Leonardo allude to above.
In a mock dataset that I tried to make emulate yours to the extent that I can, the SEM configuration converges in about a quarter of the time that the mixed-model does. See below. (Do-file and log file attached if you're interested.)
About half a minute with gsem versus two minutes with mixed on my machine.
So, something like
in your case.
In a mock dataset that I tried to make emulate yours to the extent that I can, the SEM configuration converges in about a quarter of the time that the mixed-model does. See below. (Do-file and log file attached if you're interested.)
Code:
version 18.0 clear * // seedem set seed 923940210 quietly set obs `=floor(62934 / 400)' generate `c(obs_t)' sid = _n generate double sid_u = rnormal() // My guesses as to the number of school-level & student-level predictors forvalues i = 1/4 { generate byte bet`i' = rbinomial(1, 0.5) } generate double bet5 = runiform() generate double bet6 = runiform() quietly expand 400 generate `c(obs_t)' pid = _n drawnorm sco0 sco1, double corr(1 0.5 \ 0.5 1) quietly { replace sco0 = sco0 + sid_u replace sco1 = sco1 + sid_u } forvalues i = 1/6 { generate double wit`i' = runiform() } timer clear timer on 1 gsem (sco? <- M[sid] i.(bet1-bet4) c.(wit1-wit6 bet5 bet6)), /// covstructure(e._OEn, unstructured) /// nocnsreport nodvheader nolog timer off 1 quietly reshape long sco, i(pid) j(sbj) timer on 2 mixed sco i.sbj##i.(bet1-bet4) i.sbj##c.(wit1-wit6 bet5 bet6) /// || sid: || pid: , noconstant residuals(unstructured, t(sbj)) /// nogroup nolrtest nolog timer off 2 timer list exit
So, something like
Code:
/* Nota bene: no -rename-; no -reshape- */ gsem /// ( Nrdtlectf Nrdmathf <- M[id_ecole] /// i.(sexedeelv agedeélève diflcev1ir avoirfaim rvauxdome11ique ses) /// c.(Nbelvdanslécole nbensgt) /// i.(localisation genremaitre typeécole coursdesoutien) ) /// if ecaxte > 1, /// covstructure(e._OEn, unstructured)
Comment