------------------------------------------------------------------------------- name: log: Q:\C-modelling\runmlwin\website\logfiles\2024-10-11\18\12.4.smcl log type: smcl opened on: 11 Oct 2024, 18:44:03 . **************************************************************************** . * Module 12: Cross-Classified Models - Stata Practical . * . * P12.4: Adding a Random School-by-Neighbourhood Interaction Classificati > on . * . * George Leckie . * Centre for Multilevel Modelling, 2011 . **************************************************************************** . * Stata do-file to replicate all analyses using runmlwin . * . * George Leckie . * Centre for Multilevel Modelling, 2013 . * http://www.bristol.ac.uk/cmm/software/runmlwin/ . **************************************************************************** . . use "http://www.bristol.ac.uk/cmm/media/runmlwin/12.4.dta", clear . . egen schidXneighid = group(schid neighid) . . xtmixed attain || _all: R.schid || neighid: || schidXneighid:, mle variance Performing EM optimization: Performing gradient-based optimization: Iteration 0: Log likelihood = -3179.4012 Iteration 1: Log likelihood = -3176.3699 Iteration 2: Log likelihood = -3176.2883 Iteration 3: Log likelihood = -3176.2863 Iteration 4: Log likelihood = -3176.2863 Computing standard errors: Mixed-effects ML regression Number of obs = 2,310 Grouping information ------------------------------------------------------------- | No. of Observations per group Group variable | groups Minimum Average Maximum ----------------+-------------------------------------------- _all | 1 2,310 2,310.0 2,310 neighid | 524 1 4.4 16 schidXneig~d | 784 1 2.9 14 ------------------------------------------------------------- Wald chi2(0) = . Log likelihood = -3176.2863 Prob > chi2 = . ------------------------------------------------------------------------------- attain | Coefficient Std. err. z P>|z| [95% conf. interval] --------------+---------------------------------------------------------------- _cons | .074952 .0723328 1.04 0.300 -.0668176 .2167216 ------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects parameters | Estimate Std. err. [95% conf. interval] -----------------------------+------------------------------------------------ _all: Identity | var(R.schid) | .0757556 .0320221 .0330833 .1734684 -----------------------------+------------------------------------------------ neighid: Identity | var(_cons) | .0907447 .0335894 .0439285 .1874546 -----------------------------+------------------------------------------------ schidXneig~d: Identity | var(_cons) | .0683918 .0365682 .0239816 .1950427 -----------------------------+------------------------------------------------ var(Residual) | .781917 .0271383 .7304957 .836958 ------------------------------------------------------------------------------ LR test vs. linear model: chi2(3) = 211.57 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference. . . estimates store model3 . . lrtest model1 model3 Likelihood-ratio test Assumption: model1 nested within model3 LR chi2(1) = 4.14 Prob > chi2 = 0.0419 Note: The reported degrees of freedom assumes the null hypothesis is not on the boundary of the parameter space. If this is not true, then the reported test is conservative. . end of do-file