------------------------------------------------------------------------------- name: log: Q:\C-modelling\runmlwin\website\logfiles\2020-03-27\16\13.2.smcl log type: smcl opened on: 27 Mar 2020, 18:24:15 . **************************************************************************** . * Module 13: Multiple Membership Models - Stata Practical . * . * P13.2: A Multiple Membership Model of Satisfaction . * . * 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/ . **************************************************************************** . . * P13.2.1 Specifying and fitting the multiple membership model . . use "http://www.bristol.ac.uk/cmm/media/runmlwin/13.2.dta", clear . . xtmixed satis || _all: p1-p25, nocons covariance(identity) mle variance Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -1342.9928 Iteration 1: log likelihood = -1342.9928 Computing standard errors: Mixed-effects ML regression Number of obs = 1,000 Group variable: _all Number of groups = 1 Obs per group: min = 1,000 avg = 1,000.0 max = 1,000 Wald chi2(0) = . Log likelihood = -1342.9928 Prob > chi2 = . ------------------------------------------------------------------------------ satis | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | -.0265298 .1006334 -0.26 0.792 -.2237677 .1707081 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ _all: Identity | var(p1..p25)(1) | .2323196 .0750302 .1233618 .437513 -----------------------------+------------------------------------------------ var(Residual) | .8144565 .0368917 .7452669 .8900697 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 112.48 Prob >= chibar2 = 0.0000 (1) p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24 p25 . . estimates store model1 . . . . * P13.2.2 Interpretation of the multiple membership model . . . . * P13.2.3 Calculating variance partition coefficients (VPCs) and intraclass . * correlations (ICCs) . . . . * P13.2.4 Predicting and examining nurse effects . . predict u0_1-u0_25, reffects . . predict u0se_1-u0se_25, reses . . keep u0_1-u0_25 u0se_1-u0se_25 . . describe, short Contains data from http://www.bristol.ac.uk/cmm/media/runmlwin/13.2.dta obs: 1,000 vars: 50 2 Aug 2013 17:08 Sorted by: Note: Dataset has changed since last saved. . . keep in 1 (999 observations deleted) . . describe, short Contains data from http://www.bristol.ac.uk/cmm/media/runmlwin/13.2.dta obs: 1 vars: 50 2 Aug 2013 17:08 Sorted by: Note: Dataset has changed since last saved. . . generate tempid = 1 . . reshape long u0_ u0se_, i(tempid) j(nurse) (note: j = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25) Data wide -> long ----------------------------------------------------------------------------- Number of obs. 1 -> 25 Number of variables 51 -> 4 j variable (25 values) -> nurse xij variables: u0_1 u0_2 ... u0_25 -> u0_ u0se_1 u0se_2 ... u0se_25 -> u0se_ ----------------------------------------------------------------------------- . . list +---------------------------------------+ | tempid nurse u0_ u0se_ | |---------------------------------------| 1. | 1 1 .3849375 .1600033 | 2. | 1 2 -.0405713 .147426 | 3. | 1 3 .0362931 .182111 | 4. | 1 4 .5690543 .1713927 | 5. | 1 5 -.0504199 .1599723 | |---------------------------------------| 6. | 1 6 .1142876 .1762052 | 7. | 1 7 -.6727104 .1681267 | 8. | 1 8 -1.124372 .1715745 | 9. | 1 9 .2775114 .1531365 | 10. | 1 10 -.4152805 .1493897 | |---------------------------------------| 11. | 1 11 .6948755 .1835682 | 12. | 1 12 -.2382964 .1489844 | 13. | 1 13 -.3816439 .1516241 | 14. | 1 14 .1015287 .1603146 | 15. | 1 15 .6236588 .1538221 | |---------------------------------------| 16. | 1 16 -.5780854 .1779845 | 17. | 1 17 .1186586 .1981764 | 18. | 1 18 .5363019 .1612036 | 19. | 1 19 -.5440493 .1687545 | 20. | 1 20 .2934896 .1801821 | |---------------------------------------| 21. | 1 21 -.4536053 .1540383 | 22. | 1 22 .2089115 .1615112 | 23. | 1 23 .0174384 .1727783 | 24. | 1 24 .5474904 .1771108 | 25. | 1 25 -.0254028 .1771807 | +---------------------------------------+ . . drop tempid . . rename u0_ u0 . . rename u0se_ u0se . . egen u0rank = rank(u0) . . summarize u0 Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- u0 | 25 3.28e-09 .4614037 -1.124372 .6948755 . . qnorm u0, aspectratio(1) . . serrbar u0 u0se u0rank, scale(1.96) yline(0) /// > mvopts(mlabel(nurse) mlabposition(1)) . . generate labheight = u0 + 1.96*u0se + 0.05 . . serrbar u0 u0se u0rank, scale(1.96) yline(0) /// > addplot(scatter labheight u0rank, /// > msymbol(none) mlabel(nurse) /// > mlabposition(1) mlabangle(vertical) mlabcolor(navy)) /// > ytitle("Predicted nurse effect") xtitle("Rank") /// > legend(off) . end of do-file