------------------------------------------------------------------------------- name: log: Q:\C-modelling\runmlwin\website\logfiles\2020-03-27\16\12.4.smcl log type: smcl opened on: 27 Mar 2020, 18:23:58 . **************************************************************************** . * 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.3704 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 ------------------------------------------------------------- | 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 | Coef. 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 .1950428 -----------------------------+------------------------------------------------ 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 LR chi2(1) = 4.14 (Assumption: model1 nested in model3) 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