------------------------------------------------------------------------------- name: log: Q:\C-modelling\runmlwin\website\logfiles\2020-03-27\16\13.4.smcl log type: smcl opened on: 27 Mar 2020, 18:24:18 . **************************************************************************** . * Module 13: Multiple Membership Models - Stata Practical . * . * P13.4: Adding Predictor Variables . * . * 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.4.1 Adding patient level predictor variables . . use "http://www.bristol.ac.uk/cmm/media/runmlwin/13.4.dta", clear . . xtmixed satis assess || _all: p1-p25, nocons covariance(identity) mle varianc > e Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -1184.4179 Iteration 1: log likelihood = -1184.4179 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(1) = 375.32 Log likelihood = -1184.4179 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ satis | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- assess | .4903539 .025311 19.37 0.000 .4407453 .5399625 _cons | -.0331729 .1039427 -0.32 0.750 -.2368969 .1705512 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ _all: Identity | var(p1..p25)(1) | .2550367 .0789287 .1390507 .4677699 -----------------------------+------------------------------------------------ var(Residual) | .5875303 .0266124 .5376191 .6420751 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 177.98 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 model4 . . . . * P13.4.2 Adding nurse level predictor variables . . forvalues j = 1/25 { 2. generate p`j'Xh`j' = p`j'*h`j' 3. } . . egen happiness = rsum(p1Xh1-p25Xh25) . . xtmixed satis assess happiness /// > || _all: p1-p25, nocons covariance(identity) mle variance Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -1179.7032 Iteration 1: log likelihood = -1179.7032 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(2) = 386.22 Log likelihood = -1179.7032 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ satis | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- assess | .4912155 .0252988 19.42 0.000 .4416306 .5408003 happiness | .2935754 .0870952 3.37 0.001 .1228719 .4642789 _cons | -.0313536 .0857909 -0.37 0.715 -.1995006 .1367934 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ _all: Identity | var(p1..p25)(1) | .1689407 .0541275 .0901602 .3165583 -----------------------------+------------------------------------------------ var(Residual) | .5874327 .0266036 .5375377 .6419591 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 121.39 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 model5 . . generate assessXhappiness = assess*happiness . . xtmixed satis assess happiness assessXhappiness /// > || _all: p1-p25, nocons covariance(identity) mle variance Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -1179.5245 Iteration 1: log likelihood = -1179.5245 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(3) = 386.71 Log likelihood = -1179.5245 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------- --- satis | Coef. Std. Err. z P>|z| [95% Conf. Interv > al] -----------------+------------------------------------------------------------- --- assess | .4909478 .0252997 19.41 0.000 .4413614 .5405 > 343 happiness | .2934914 .0868561 3.38 0.001 .1232566 .4637 > 263 assessXhappiness | -.0186508 .0311785 -0.60 0.550 -.0797595 .042 > 458 _cons | -.0320242 .0855514 -0.37 0.708 -.199702 .1356 > 535 ------------------------------------------------------------------------------- --- ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ _all: Identity | var(p1..p25)(1) | .167888 .0538564 .0895292 .314829 -----------------------------+------------------------------------------------ var(Residual) | .5873007 .026598 .5374163 .6418155 ------------------------------------------------------------------------------ LR test vs. linear model: chibar2(01) = 119.95 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 model6 . end of do-file