R version 3.6.3 (2020-02-29) -- "Holding the Windsock" Copyright (C) 2020 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ############################################################################ > # MLwiN MCMC Manual > # > # 4 Other Features of Variance Components Models . . . . . . . . . . . .45 > # > # Browne, W.J. (2009) MCMC Estimation in MLwiN, v2.13. Centre for > # Multilevel Modelling, University of Bristol. > ############################################################################ > # R script to replicate all analyses using R2MLwiN > # > # Zhang, Z., Charlton, C., Parker, R, Leckie, G., and Browne, W.J. > # Centre for Multilevel Modelling, 2012 > # http://www.bristol.ac.uk/cmm/software/R2MLwiN/ > ############################################################################ > > library(R2MLwiN) R2MLwiN: A package to run models implemented in MLwiN from R Copyright 2013-2017 Zhengzheng Zhang, Christopher M. J. Charlton, Richard M. A. Parker, William J. Browne and George Leckie Support provided by the Economic and Social Research Council (ESRC) (Grants RES-149-25-1084, RES-576-25-0032 and ES/K007246/1) To cite R2MLwiN in publications use: Zhengzheng Zhang, Richard M. A. Parker, Christopher M. J. Charlton, George Leckie, William J. Browne (2016). R2MLwiN: A Package to Run MLwiN from within R. Journal of Statistical Software, 72(10), 1-43. doi:10.18637/jss.v072.i10 A BibTeX entry for LaTeX users is @Article{, title = {{R2MLwiN}: A Package to Run {MLwiN} from within {R}}, author = {Zhengzheng Zhang and Richard M. A. Parker and Christopher M. J. Charlton and George Leckie and William J. Browne}, journal = {Journal of Statistical Software}, year = {2016}, volume = {72}, number = {10}, pages = {1--43}, doi = {10.18637/jss.v072.i10}, } The MLwiN_path option is currently set to C:/Program Files/MLwiN v3.05/ To change this use: options(MLwiN_path="") > # MLwiN folder > mlwin <- getOption("MLwiN_path") > while (!file.access(mlwin, mode = 1) == 0) { + cat("Please specify the root MLwiN folder or the full path to the MLwiN executable:\n") + mlwin <- scan(what = character(0), sep = "\n") + mlwin <- gsub("\\", "/", mlwin, fixed = TRUE) + } > options(MLwiN_path = mlwin) > > ## save current par settings > mypar <- par(no.readonly = TRUE) > > ## Read tutorial data > data(tutorial, package = "R2MLwiN") > > ## IGLS > (mymodel1 <- runMLwiN(normexam ~ 1 + standlrt + (1 | school) + (1 | student), data = tutorial)) /nogui option ignored ECHO 0 Echoing is ON BATC 1 Batch mode is ON MAXI 2 STAR iteration 0 iteration 1 Convergence not achieved TOLE 2 MAXI 20 NEXT iteration 2 iteration 3 Convergence achieved ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.05) multilevel model (Normal) N min mean max N_complete min_complete mean_complete max_complete school 65 2 62.44615 198 65 2 62.44615 198 Estimation algorithm: IGLS Elapsed time : 0.05s Number of obs: 4059 (from total 4059) The model converged after 4 iterations. Log likelihood: -4678.6 Deviance statistic: 9357.2 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + (1 | school) + (1 | student) Level 2: school Level 1: student --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Conf. Interval] Intercept 0.00239 0.04002 0.06 0.9524 -0.07605 0.08083 standlrt 0.56337 0.01247 45.19 0 *** 0.53894 0.58780 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 --------------------------------------------------------------------------------------------------- The random part estimates at the school level: Coef. Std. Err. var_Intercept 0.09213 0.01815 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. var_Intercept 0.56573 0.01266 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > ## Gibbs > (mymodel2 <- runMLwiN(normexam ~ 1 + standlrt + (1 | school) + (1 | student), estoptions = list(EstM = 1), data = tutorial)) MLwiN is running, please wait...... /nogui option ignored ECHO 0 Echoing is ON BATC 1 Batch mode is ON MAXI 2 STAR iteration 0 iteration 1 Convergence not achieved TOLE 2 MAXI 20 BATC 1 Batch mode is ON NEXT iteration 2 iteration 3 Convergence achieved ECHO 0 Echoing is ON MCMC 0 500 1 5.8 50 10 G30[1] G30[2] 1 1 1 1 1 1 Burning in for 50 iterations out of 500 -2 * Loglike = 9204.262556 Burning in for 100 iterations out of 500 -2 * Loglike = 9225.063419 Burning in for 150 iterations out of 500 -2 * Loglike = 9205.620423 Burning in for 200 iterations out of 500 -2 * Loglike = 9207.286175 Burning in for 250 iterations out of 500 -2 * Loglike = 9189.882541 Burning in for 300 iterations out of 500 -2 * Loglike = 9213.131781 Burning in for 350 iterations out of 500 -2 * Loglike = 9191.967839 Burning in for 400 iterations out of 500 -2 * Loglike = 9200.072789 Burning in for 450 iterations out of 500 -2 * Loglike = 9197.978878 Burning in for 500 iterations out of 500 -2 * Loglike = 9206.312775 ERAS G30 LINK 0 G30 ERAS c1090 c1091 MCMC 1 5000 1 c1090 c1091 c1003 c1004 1 1 Actual update 50 of 5000, Stored update 50 of 5000 -2 * Loglike = 9182.514808 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 9224.799767 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 9192.533264 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 9235.302728 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 9192.588497 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 9200.798346 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 9215.971258 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 9191.471053 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 9216.792403 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 9185.644474 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 9203.752807 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 9201.223665 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 9215.804872 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 9204.519349 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 9189.609771 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 9213.416013 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 9211.107554 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 9219.303837 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 9195.273065 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 9191.690604 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 9215.236489 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 9218.185496 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 9210.517749 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 9225.032838 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 9202.460499 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 9225.333397 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 9208.977623 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 9210.427472 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 9225.575111 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 9202.428957 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 9200.886427 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 9198.521334 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 9207.777166 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 9198.900296 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 9208.265053 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 9203.987061 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 9207.776243 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 9215.497296 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 9224.467108 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 9194.146736 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 9212.845807 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 9224.944089 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 9213.612843 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 9198.265355 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 9195.222358 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 9250.643212 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 9194.598687 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 9214.421500 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 9240.315838 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 9235.012216 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 9188.825586 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 9220.910444 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 9198.293627 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 9205.222052 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 9209.264188 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 9211.039764 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 9230.996469 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 9224.580436 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 9199.499799 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 9215.292584 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 9207.040587 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 9202.604250 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 9216.541549 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 9205.256474 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 9211.029403 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 9186.699312 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 9210.823399 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 9207.867998 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 9219.418322 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 9206.509889 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 9211.940598 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 9209.426437 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 9217.104187 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 9206.433860 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 9208.530610 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 9212.678566 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 9201.101902 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 9202.943453 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 9226.646620 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 9199.272707 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 9185.496662 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 9204.693995 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 9205.338782 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 9218.098365 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 9192.878156 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 9211.471250 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 9217.216161 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 9214.835575 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 9208.972779 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 9223.102763 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 9203.956845 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 9201.960121 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 9194.101999 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 9207.476225 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 9215.003009 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 9186.582930 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 9202.744286 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 9228.521835 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 9210.720494 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 9214.075214 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 9208.8 S.D. = 12.005 S.E.M. = 0.16978 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.05) multilevel model (Normal) N min mean max N_complete min_complete mean_complete max_complete school 65 2 62.44615 198 65 2 62.44615 198 Estimation algorithm: MCMC Elapsed time : 1.43s Number of obs: 4059 (from total 4059) Number of iter.: 5000 Chains: 1 Burn-in: 500 Bayesian Deviance Information Criterion (DIC) Dbar D(thetabar) pD DIC 9208.817 9148.971 59.846 9268.664 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + (1 | school) + (1 | student) Level 2: school Level 1: student --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept 0.00133 0.04216 0.03 0.9748 -0.07762 0.08519 208 standlrt 0.56331 0.01254 44.93 0 *** 0.53892 0.58799 4017 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 --------------------------------------------------------------------------------------------------- The random part estimates at the school level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.09732 0.02049 0.06441 0.14454 2981 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.56634 0.01269 0.54175 0.59197 5000 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > # 4.1 Metropolis Hastings (MH) sampling for the variance components model 46 > > # 4.2 Metropolis-Hastings settings . . . . . . . . . . . . . . . . . . . .47 > > # 4.3 Running the variance components with Metropolis Hastings . . . . . .48 > > ## MH Adaptive with defaults > (mymodel3 <- runMLwiN(normexam ~ 1 + standlrt + (1 | school) + (1 | student), estoptions = list(EstM = 1, mcmcMeth = list(fixM = 2, + residM = 2, Lev1VarM = 2)), data = tutorial)) MLwiN is running, please wait...... /nogui option ignored ECHO 0 Echoing is ON BATC 1 Batch mode is ON MAXI 2 STAR iteration 0 iteration 1 Convergence not achieved TOLE 2 MAXI 20 BATC 1 Batch mode is ON NEXT iteration 2 iteration 3 Convergence achieved ECHO 0 Echoing is ON MCMC 0 500 1 5.8 50 10 G30[1] G30[2] 2 2 2 1 1 1 Adapting for 100 iterations (Maximum 5000) -2 * Loglike = 9216.844704 Adapting for 200 iterations (Maximum 5000) -2 * Loglike = 9193.344641 Adapting for 300 iterations (Maximum 5000) -2 * Loglike = 9239.110702 Adapting for 400 iterations (Maximum 5000) -2 * Loglike = 9194.362765 Adapting for 500 iterations (Maximum 5000) -2 * Loglike = 9209.835731 Adapting for 600 iterations (Maximum 5000) -2 * Loglike = 9201.870385 Adapting for 700 iterations (Maximum 5000) -2 * Loglike = 9211.666095 Adapting for 800 iterations (Maximum 5000) -2 * Loglike = 9228.713520 Adapting for 900 iterations (Maximum 5000) -2 * Loglike = 9201.487690 Adapting for 1000 iterations (Maximum 5000) -2 * Loglike = 9214.630209 Adapting finished and took 1100 iterations Adapting took 1100 iterations Burning in for 50 iterations out of 500 -2 * Loglike = 9209.666936 Burning in for 100 iterations out of 500 -2 * Loglike = 9206.912618 Burning in for 150 iterations out of 500 -2 * Loglike = 9213.749081 Burning in for 200 iterations out of 500 -2 * Loglike = 9213.324126 Burning in for 250 iterations out of 500 -2 * Loglike = 9203.170254 Burning in for 300 iterations out of 500 -2 * Loglike = 9230.452320 Burning in for 350 iterations out of 500 -2 * Loglike = 9216.213573 Burning in for 400 iterations out of 500 -2 * Loglike = 9201.829297 Burning in for 450 iterations out of 500 -2 * Loglike = 9211.087198 Burning in for 500 iterations out of 500 -2 * Loglike = 9216.124189 ERAS G30 LINK 0 G30 ERAS c1090 c1091 MCMC 1 5000 1 c1090 c1091 c1003 c1004 1 1 Actual update 50 of 5000, Stored update 50 of 5000 -2 * Loglike = 9205.171301 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 9222.181560 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 9203.968310 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 9221.229332 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 9214.287173 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 9199.220312 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 9201.799380 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 9215.784384 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 9225.801301 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 9203.603229 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 9206.897411 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 9230.695855 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 9192.683952 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 9212.754032 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 9183.656330 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 9209.531938 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 9197.737688 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 9214.084204 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 9239.810887 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 9221.785372 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 9210.388680 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 9228.432003 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 9220.585163 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 9201.348864 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 9207.767181 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 9203.234001 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 9209.980094 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 9210.065929 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 9215.016235 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 9210.590129 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 9231.127213 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 9198.362706 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 9194.500853 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 9206.200960 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 9210.928435 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 9207.926217 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 9203.075050 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 9196.455544 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 9229.428091 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 9209.802144 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 9221.465306 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 9219.779715 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 9205.789940 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 9213.136026 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 9213.734572 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 9208.256315 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 9198.851242 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 9198.211226 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 9204.658511 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 9204.373734 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 9204.887682 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 9214.430977 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 9215.254316 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 9214.810680 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 9202.486485 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 9226.249858 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 9187.310207 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 9185.707594 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 9206.616797 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 9213.142931 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 9192.488200 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 9219.601330 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 9211.289509 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 9198.502389 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 9207.122868 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 9204.487531 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 9220.162568 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 9207.944380 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 9232.116261 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 9203.473497 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 9203.609812 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 9207.835942 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 9223.561330 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 9217.226086 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 9197.942220 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 9201.726301 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 9219.117524 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 9206.283642 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 9197.304076 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 9206.002206 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 9199.436647 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 9204.046734 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 9193.373769 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 9186.480109 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 9222.120047 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 9198.039713 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 9204.564282 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 9215.307365 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 9188.898210 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 9201.413123 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 9202.677981 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 9214.486268 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 9222.441666 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 9243.059228 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 9221.311150 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 9202.431425 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 9206.144636 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 9235.130272 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 9216.824492 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 9230.171899 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 9209.1 S.D. = 11.534 S.E.M. = 0.16311 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.05) multilevel model (Normal) N min mean max N_complete min_complete mean_complete max_complete school 65 2 62.44615 198 65 2 62.44615 198 Estimation algorithm: MCMC Elapsed time : 0.95s Number of obs: 4059 (from total 4059) Number of iter.: 5000 Chains: 1 Burn-in: 500 Bayesian Deviance Information Criterion (DIC) Dbar D(thetabar) pD DIC 9209.051 9149.217 59.834 9268.885 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + (1 | school) + (1 | student) Level 2: school Level 1: student --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept 0.00057 0.04127 0.01 0.989 -0.07841 0.07812 55 standlrt 0.56334 0.01248 45.14 0 *** 0.53872 0.58814 958 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 --------------------------------------------------------------------------------------------------- The random part estimates at the school level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.09695 0.02025 0.06387 0.14442 1935 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.56635 0.01269 0.54208 0.59130 4574 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > sixway(mymodel3@chains[, "FP_standlrt", drop = FALSE], "beta_1") > > ## MH Scale Factor = 5.8 > (mymodel4 <- runMLwiN(normexam ~ 1 + standlrt + (1 | school) + (1 | student), estoptions = list(EstM = 1, mcmcMeth = list(fixM = 2, + residM = 2, Lev1VarM = 2, adaption = 0)), data = tutorial)) MLwiN is running, please wait...... /nogui option ignored ECHO 0 Echoing is ON BATC 1 Batch mode is ON MAXI 2 STAR iteration 0 iteration 1 Convergence not achieved TOLE 2 MAXI 20 BATC 1 Batch mode is ON NEXT iteration 2 iteration 3 Convergence achieved ECHO 0 Echoing is ON MCMC 0 500 0 5.8 50 10 G30[1] G30[2] 2 2 2 1 1 1 Burning in for 50 iterations out of 500 -2 * Loglike = 9171.220847 Burning in for 100 iterations out of 500 -2 * Loglike = 9219.355908 Burning in for 150 iterations out of 500 -2 * Loglike = 9194.050535 Burning in for 200 iterations out of 500 -2 * Loglike = 9207.295081 Burning in for 250 iterations out of 500 -2 * Loglike = 9206.250615 Burning in for 300 iterations out of 500 -2 * Loglike = 9203.850967 Burning in for 350 iterations out of 500 -2 * Loglike = 9211.711292 Burning in for 400 iterations out of 500 -2 * Loglike = 9206.743418 Burning in for 450 iterations out of 500 -2 * Loglike = 9179.907712 Burning in for 500 iterations out of 500 -2 * Loglike = 9199.459807 ERAS G30 LINK 0 G30 ERAS c1090 c1091 MCMC 1 5000 1 c1090 c1091 c1003 c1004 1 1 Actual update 50 of 5000, Stored update 50 of 5000 -2 * Loglike = 9208.353135 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 9243.794925 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 9212.610629 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 9214.551314 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 9208.896686 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 9208.969496 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 9203.531162 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 9218.277278 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 9197.125856 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 9207.690828 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 9187.296181 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 9239.212606 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 9218.480990 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 9221.498899 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 9208.793375 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 9210.317804 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 9210.794030 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 9206.222753 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 9229.883417 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 9198.911134 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 9200.735380 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 9214.938277 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 9213.526179 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 9195.253149 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 9213.417265 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 9219.643541 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 9192.423925 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 9231.831405 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 9222.083808 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 9200.165093 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 9212.516645 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 9192.610265 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 9222.047965 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 9217.310825 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 9217.683252 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 9199.318289 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 9204.668718 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 9194.445647 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 9208.505097 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 9210.942711 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 9200.816303 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 9193.853391 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 9206.930810 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 9201.435020 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 9193.744381 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 9202.603705 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 9205.232435 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 9211.387870 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 9224.213875 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 9210.423604 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 9208.686077 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 9203.383402 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 9215.573084 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 9206.700672 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 9202.771344 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 9197.962193 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 9203.464432 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 9195.759519 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 9199.886544 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 9201.194822 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 9197.503378 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 9199.027470 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 9204.990047 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 9200.091903 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 9208.458282 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 9199.437898 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 9186.950339 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 9201.671581 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 9211.268116 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 9204.500174 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 9203.497142 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 9199.916961 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 9191.372672 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 9210.796616 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 9211.012015 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 9210.647368 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 9219.869612 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 9183.195257 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 9196.037743 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 9193.855767 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 9203.304781 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 9230.341949 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 9197.360692 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 9195.892670 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 9218.477476 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 9216.109482 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 9207.208101 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 9212.217832 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 9205.367101 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 9208.361384 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 9198.375637 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 9219.935077 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 9213.341407 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 9203.986680 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 9215.347778 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 9236.879333 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 9220.357941 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 9205.917980 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 9182.847469 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 9179.948488 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 9209.1 S.D. = 11.755 S.E.M. = 0.16624 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.05) multilevel model (Normal) N min mean max N_complete min_complete mean_complete max_complete school 65 2 62.44615 198 65 2 62.44615 198 Estimation algorithm: MCMC Elapsed time : 0.86s Number of obs: 4059 (from total 4059) Number of iter.: 5000 Chains: 1 Burn-in: 500 Bayesian Deviance Information Criterion (DIC) Dbar D(thetabar) pD DIC 9209.072 9149.406 59.666 9268.738 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + (1 | school) + (1 | student) Level 2: school Level 1: student --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept -0.00490 0.03726 -0.13 0.8953 -0.07788 0.06390 35 standlrt 0.56326 0.01230 45.78 0 *** 0.53822 0.58709 1041 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 --------------------------------------------------------------------------------------------------- The random part estimates at the school level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.09618 0.01958 0.06419 0.13992 2097 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.56630 0.01258 0.54206 0.59148 4198 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > if (!require(texreg)) { + warning("texreg package required to use screenreg() function") + } else { + screenreg(list(mymodel1, mymodel2, mymodel4, mymodel3), custom.model.names=c("IGLS", "Gibbs", "MH", "MH Adaptive"), groups = list("Fixed Part" = 1:2, "Level-2" = 3:3, "Level-1" = 4:4), + stars = numeric(0), include.nobs=FALSE, include.loglik=FALSE, include.deviance=FALSE, include.dbar=FALSE, include.dthetabar=FALSE, include.pd=FALSE, include.dic=FALSE) + } Loading required package: texreg Version: 1.36.23 Date: 2017-03-03 Author: Philip Leifeld (University of Glasgow) Please cite the JSS article in your publications -- see citation("texreg"). ========================================================================== IGLS Gibbs MH MH Adaptive -------------------------------------------------------------------------- Fixed Part FP_Intercept 0.00 0.00 -0.00 0.00 (0.04) [-0.08; 0.09] [-0.08; 0.06] [-0.08; 0.08] FP_standlrt 0.56 0.56 * 0.56 * 0.56 * (0.01) [ 0.54; 0.59] [ 0.54; 0.59] [ 0.54; 0.59] Level-2 RP2_var_Intercept 0.09 0.10 * 0.10 * 0.10 * (0.02) [ 0.06; 0.14] [ 0.06; 0.14] [ 0.06; 0.14] Level-1 RP1_var_Intercept 0.57 0.57 * 0.57 * 0.57 * (0.01) [ 0.54; 0.59] [ 0.54; 0.59] [ 0.54; 0.59] ========================================================================== * 0 outside the confidence interval > > rm(list = c("mymodel1", "mymodel2", "mymodel3", "mymodel4")) > # 4.4 MH cycles per Gibbs iteration . . . . . . . . . . . . . . . . . . . 49 > > # 4.5 Block updating MH sampling . . . . . . . . . . . . . . . . . . . . .49 > ## MH Adaptive with defaults > (mymodel5 <- runMLwiN(normexam ~ 1 + standlrt + (1 | school) + (1 | student), estoptions = list(EstM = 1, mcmcMeth = list(fixM = 3, + residM = 2, Lev1VarM = 2, rate = 40)), data = tutorial)) MLwiN is running, please wait...... /nogui option ignored ECHO 0 Echoing is ON BATC 1 Batch mode is ON MAXI 2 STAR iteration 0 iteration 1 Convergence not achieved TOLE 2 MAXI 20 BATC 1 Batch mode is ON NEXT iteration 2 iteration 3 Convergence achieved ECHO 0 Echoing is ON MCMC 0 500 1 5.8 40 10 G30[1] G30[2] 3 2 2 1 1 1 Adapting for 100 iterations (Maximum 5000) -2 * Loglike = 9205.274939 Adapting for 200 iterations (Maximum 5000) -2 * Loglike = 9207.154246 Adapting for 300 iterations (Maximum 5000) -2 * Loglike = 9205.865282 Adapting for 400 iterations (Maximum 5000) -2 * Loglike = 9189.994303 Adapting for 500 iterations (Maximum 5000) -2 * Loglike = 9206.831573 Adapting for 600 iterations (Maximum 5000) -2 * Loglike = 9211.061887 Adapting for 700 iterations (Maximum 5000) -2 * Loglike = 9223.810789 Adapting for 800 iterations (Maximum 5000) -2 * Loglike = 9213.201063 Adapting for 900 iterations (Maximum 5000) -2 * Loglike = 9229.179609 Adapting finished and took 1000 iterations Adapting took 1000 iterations Burning in for 50 iterations out of 500 -2 * Loglike = 9202.129324 Burning in for 100 iterations out of 500 -2 * Loglike = 9203.780550 Burning in for 150 iterations out of 500 -2 * Loglike = 9222.118688 Burning in for 200 iterations out of 500 -2 * Loglike = 9205.165605 Burning in for 250 iterations out of 500 -2 * Loglike = 9199.505410 Burning in for 300 iterations out of 500 -2 * Loglike = 9201.981545 Burning in for 350 iterations out of 500 -2 * Loglike = 9192.573256 Burning in for 400 iterations out of 500 -2 * Loglike = 9210.595915 Burning in for 450 iterations out of 500 -2 * Loglike = 9226.899457 Burning in for 500 iterations out of 500 -2 * Loglike = 9228.587442 ERAS G30 LINK 0 G30 ERAS c1090 c1091 MCMC 1 5000 1 c1090 c1091 c1003 c1004 1 1 Actual update 50 of 5000, Stored update 50 of 5000 -2 * Loglike = 9213.921473 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 9214.647424 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 9212.034868 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 9224.275037 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 9215.114203 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 9208.478928 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 9202.543354 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 9209.269160 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 9195.194786 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 9198.801115 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 9228.212051 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 9205.286562 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 9194.149660 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 9203.664357 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 9208.856400 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 9229.285342 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 9206.595492 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 9204.788493 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 9201.423478 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 9245.931369 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 9197.353286 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 9211.291457 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 9196.418464 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 9208.851559 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 9204.800123 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 9183.021681 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 9217.310383 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 9197.150199 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 9216.088553 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 9229.002156 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 9215.357260 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 9212.530419 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 9214.096052 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 9201.217777 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 9190.956212 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 9221.282748 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 9195.665469 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 9209.345049 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 9214.979074 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 9196.469492 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 9210.262477 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 9196.981773 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 9213.090233 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 9213.647418 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 9218.376165 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 9214.511279 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 9190.996199 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 9193.008720 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 9196.158775 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 9208.168126 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 9241.854171 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 9205.265053 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 9208.767054 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 9205.060995 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 9190.956044 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 9202.711282 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 9214.705042 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 9230.667512 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 9203.859969 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 9199.627327 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 9198.351260 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 9229.068482 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 9207.189519 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 9216.004301 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 9197.558970 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 9230.809631 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 9219.764881 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 9228.240649 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 9208.529049 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 9202.151943 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 9194.672043 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 9211.260089 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 9201.484083 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 9225.942644 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 9216.191038 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 9218.197677 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 9211.052791 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 9218.529071 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 9192.276805 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 9219.464299 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 9197.028737 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 9215.173434 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 9209.376755 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 9207.919556 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 9204.656989 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 9219.289048 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 9193.203522 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 9193.849419 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 9197.126506 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 9213.973346 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 9212.899853 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 9224.954754 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 9197.748788 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 9196.781540 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 9224.740163 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 9204.155682 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 9199.660249 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 9222.340260 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 9193.418859 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 9208.656082 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 9209.2 S.D. = 11.852 S.E.M. = 0.16761 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.05) multilevel model (Normal) N min mean max N_complete min_complete mean_complete max_complete school 65 2 62.44615 198 65 2 62.44615 198 Estimation algorithm: MCMC Elapsed time : 0.95s Number of obs: 4059 (from total 4059) Number of iter.: 5000 Chains: 1 Burn-in: 500 Bayesian Deviance Information Criterion (DIC) Dbar D(thetabar) pD DIC 9209.164 9149.361 59.803 9268.968 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + (1 | school) + (1 | student) Level 2: school Level 1: student --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept 0.00371 0.04171 0.09 0.9292 -0.08601 0.08174 43 standlrt 0.56366 0.01273 44.29 0 *** 0.53862 0.58772 197 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 --------------------------------------------------------------------------------------------------- The random part estimates at the school level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.09667 0.02027 0.06447 0.14289 1887 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.56623 0.01253 0.54252 0.59148 4142 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > estimates <- mymodel5@chains > opar <- par(mfrow = c(3, 2)) > plot(4951:nrow(estimates), estimates[4951:nrow(estimates), "deviance"], xlab = "iteration", ylab = expression(paste("Est. of deviance")), + type = "l") > plot(4951:nrow(estimates), estimates[4951:nrow(estimates), "FP_Intercept"], xlab = "iteration", ylab = expression(paste("Est. of ", + beta[0])), type = "l") > plot(4951:nrow(estimates), estimates[4951:nrow(estimates), "FP_standlrt"], xlab = "iteration", ylab = expression(paste("Est. of ", + beta[1])), type = "l") > plot(4951:nrow(estimates), estimates[4951:nrow(estimates), "RP2_var_Intercept"], xlab = "iteration", ylab = expression(paste("Est. of ", + sigma[u0]^2)), type = "l") > plot(4951:nrow(estimates), estimates[4951:nrow(estimates), "RP1_var_Intercept"], xlab = "iteration", ylab = expression(paste("Est. of ", + sigma[e0]^2)), type = "l") > #par(opar) > par(mfrow = c(1, 1)) > rm(mymodel5) > > # 4.6 Residuals in MCMC . . . . . . . . . . . . . . . . . . . . . . . . . 51 > > (mymodel6 <- runMLwiN(normexam ~ 1 + standlrt + (1 | school) + (1 | student), estoptions = list(EstM = 1, resi.store = TRUE, + resi.store.levs = 2, mcmcMeth = list(iterations = 5001)), data = tutorial)) MLwiN is running, please wait...... /nogui option ignored ECHO 0 Echoing is ON BATC 1 Batch mode is ON MAXI 2 STAR iteration 0 iteration 1 Convergence not achieved TOLE 2 MAXI 20 BATC 1 Batch mode is ON NEXT iteration 2 iteration 3 Convergence achieved ECHO 0 Echoing is ON MCMC 0 500 1 5.8 50 10 G30[1] G30[2] 1 1 1 1 1 1 Burning in for 50 iterations out of 500 -2 * Loglike = 9204.262556 Burning in for 100 iterations out of 500 -2 * Loglike = 9225.063419 Burning in for 150 iterations out of 500 -2 * Loglike = 9205.620423 Burning in for 200 iterations out of 500 -2 * Loglike = 9207.286175 Burning in for 250 iterations out of 500 -2 * Loglike = 9189.882541 Burning in for 300 iterations out of 500 -2 * Loglike = 9213.131781 Burning in for 350 iterations out of 500 -2 * Loglike = 9191.967839 Burning in for 400 iterations out of 500 -2 * Loglike = 9200.072789 Burning in for 450 iterations out of 500 -2 * Loglike = 9197.978878 Burning in for 500 iterations out of 500 -2 * Loglike = 9206.312775 ERAS G30 LINK 0 G30 ERAS c1090 c1091 MCMC 1 5001 1 c1090 c1091 c1003 c1004 1 1 Actual update 50 of 5001, Stored update 50 of 5001 -2 * Loglike = 9182.514808 Actual update 100 of 5001, Stored update 100 of 5001 -2 * Loglike = 9224.799767 Actual update 150 of 5001, Stored update 150 of 5001 -2 * Loglike = 9192.533264 Actual update 200 of 5001, Stored update 200 of 5001 -2 * Loglike = 9235.302728 Actual update 250 of 5001, Stored update 250 of 5001 -2 * Loglike = 9192.588497 Actual update 300 of 5001, Stored update 300 of 5001 -2 * Loglike = 9200.798346 Actual update 350 of 5001, Stored update 350 of 5001 -2 * Loglike = 9215.971258 Actual update 400 of 5001, Stored update 400 of 5001 -2 * Loglike = 9191.471053 Actual update 450 of 5001, Stored update 450 of 5001 -2 * Loglike = 9216.792403 Actual update 500 of 5001, Stored update 500 of 5001 -2 * Loglike = 9185.644474 Actual update 550 of 5001, Stored update 550 of 5001 -2 * Loglike = 9203.752807 Actual update 600 of 5001, Stored update 600 of 5001 -2 * Loglike = 9201.223665 Actual update 650 of 5001, Stored update 650 of 5001 -2 * Loglike = 9215.804872 Actual update 700 of 5001, Stored update 700 of 5001 -2 * Loglike = 9204.519349 Actual update 750 of 5001, Stored update 750 of 5001 -2 * Loglike = 9189.609771 Actual update 800 of 5001, Stored update 800 of 5001 -2 * Loglike = 9213.416013 Actual update 850 of 5001, Stored update 850 of 5001 -2 * Loglike = 9211.107554 Actual update 900 of 5001, Stored update 900 of 5001 -2 * Loglike = 9219.303837 Actual update 950 of 5001, Stored update 950 of 5001 -2 * Loglike = 9195.273065 Actual update 1000 of 5001, Stored update 1000 of 5001 -2 * Loglike = 9191.690604 Actual update 1050 of 5001, Stored update 1050 of 5001 -2 * Loglike = 9215.236489 Actual update 1100 of 5001, Stored update 1100 of 5001 -2 * Loglike = 9218.185496 Actual update 1150 of 5001, Stored update 1150 of 5001 -2 * Loglike = 9210.517749 Actual update 1200 of 5001, Stored update 1200 of 5001 -2 * Loglike = 9225.032838 Actual update 1250 of 5001, Stored update 1250 of 5001 -2 * Loglike = 9202.460499 Actual update 1300 of 5001, Stored update 1300 of 5001 -2 * Loglike = 9225.333397 Actual update 1350 of 5001, Stored update 1350 of 5001 -2 * Loglike = 9208.977623 Actual update 1400 of 5001, Stored update 1400 of 5001 -2 * Loglike = 9210.427472 Actual update 1450 of 5001, Stored update 1450 of 5001 -2 * Loglike = 9225.575111 Actual update 1500 of 5001, Stored update 1500 of 5001 -2 * Loglike = 9202.428957 Actual update 1550 of 5001, Stored update 1550 of 5001 -2 * Loglike = 9200.886427 Actual update 1600 of 5001, Stored update 1600 of 5001 -2 * Loglike = 9198.521334 Actual update 1650 of 5001, Stored update 1650 of 5001 -2 * Loglike = 9207.777166 Actual update 1700 of 5001, Stored update 1700 of 5001 -2 * Loglike = 9198.900296 Actual update 1750 of 5001, Stored update 1750 of 5001 -2 * Loglike = 9208.265053 Actual update 1800 of 5001, Stored update 1800 of 5001 -2 * Loglike = 9203.987061 Actual update 1850 of 5001, Stored update 1850 of 5001 -2 * Loglike = 9207.776243 Actual update 1900 of 5001, Stored update 1900 of 5001 -2 * Loglike = 9215.497296 Actual update 1950 of 5001, Stored update 1950 of 5001 -2 * Loglike = 9224.467108 Actual update 2000 of 5001, Stored update 2000 of 5001 -2 * Loglike = 9194.146736 Actual update 2050 of 5001, Stored update 2050 of 5001 -2 * Loglike = 9212.845807 Actual update 2100 of 5001, Stored update 2100 of 5001 -2 * Loglike = 9224.944089 Actual update 2150 of 5001, Stored update 2150 of 5001 -2 * Loglike = 9213.612843 Actual update 2200 of 5001, Stored update 2200 of 5001 -2 * Loglike = 9198.265355 Actual update 2250 of 5001, Stored update 2250 of 5001 -2 * Loglike = 9195.222358 Actual update 2300 of 5001, Stored update 2300 of 5001 -2 * Loglike = 9250.643212 Actual update 2350 of 5001, Stored update 2350 of 5001 -2 * Loglike = 9194.598687 Actual update 2400 of 5001, Stored update 2400 of 5001 -2 * Loglike = 9214.421500 Actual update 2450 of 5001, Stored update 2450 of 5001 -2 * Loglike = 9240.315838 Actual update 2500 of 5001, Stored update 2500 of 5001 -2 * Loglike = 9235.012216 Actual update 2550 of 5001, Stored update 2550 of 5001 -2 * Loglike = 9188.825586 Actual update 2600 of 5001, Stored update 2600 of 5001 -2 * Loglike = 9220.910444 Actual update 2650 of 5001, Stored update 2650 of 5001 -2 * Loglike = 9198.293627 Actual update 2700 of 5001, Stored update 2700 of 5001 -2 * Loglike = 9205.222052 Actual update 2750 of 5001, Stored update 2750 of 5001 -2 * Loglike = 9209.264188 Actual update 2800 of 5001, Stored update 2800 of 5001 -2 * Loglike = 9211.039764 Actual update 2850 of 5001, Stored update 2850 of 5001 -2 * Loglike = 9230.996469 Actual update 2900 of 5001, Stored update 2900 of 5001 -2 * Loglike = 9224.580436 Actual update 2950 of 5001, Stored update 2950 of 5001 -2 * Loglike = 9199.499799 Actual update 3000 of 5001, Stored update 3000 of 5001 -2 * Loglike = 9215.292584 Actual update 3050 of 5001, Stored update 3050 of 5001 -2 * Loglike = 9207.040587 Actual update 3100 of 5001, Stored update 3100 of 5001 -2 * Loglike = 9202.604250 Actual update 3150 of 5001, Stored update 3150 of 5001 -2 * Loglike = 9216.541549 Actual update 3200 of 5001, Stored update 3200 of 5001 -2 * Loglike = 9205.256474 Actual update 3250 of 5001, Stored update 3250 of 5001 -2 * Loglike = 9211.029403 Actual update 3300 of 5001, Stored update 3300 of 5001 -2 * Loglike = 9186.699312 Actual update 3350 of 5001, Stored update 3350 of 5001 -2 * Loglike = 9210.823399 Actual update 3400 of 5001, Stored update 3400 of 5001 -2 * Loglike = 9207.867998 Actual update 3450 of 5001, Stored update 3450 of 5001 -2 * Loglike = 9219.418322 Actual update 3500 of 5001, Stored update 3500 of 5001 -2 * Loglike = 9206.509889 Actual update 3550 of 5001, Stored update 3550 of 5001 -2 * Loglike = 9211.940598 Actual update 3600 of 5001, Stored update 3600 of 5001 -2 * Loglike = 9209.426437 Actual update 3650 of 5001, Stored update 3650 of 5001 -2 * Loglike = 9217.104187 Actual update 3700 of 5001, Stored update 3700 of 5001 -2 * Loglike = 9206.433860 Actual update 3750 of 5001, Stored update 3750 of 5001 -2 * Loglike = 9208.530610 Actual update 3800 of 5001, Stored update 3800 of 5001 -2 * Loglike = 9212.678566 Actual update 3850 of 5001, Stored update 3850 of 5001 -2 * Loglike = 9201.101902 Actual update 3900 of 5001, Stored update 3900 of 5001 -2 * Loglike = 9202.943453 Actual update 3950 of 5001, Stored update 3950 of 5001 -2 * Loglike = 9226.646620 Actual update 4000 of 5001, Stored update 4000 of 5001 -2 * Loglike = 9199.272707 Actual update 4050 of 5001, Stored update 4050 of 5001 -2 * Loglike = 9185.496662 Actual update 4100 of 5001, Stored update 4100 of 5001 -2 * Loglike = 9204.693995 Actual update 4150 of 5001, Stored update 4150 of 5001 -2 * Loglike = 9205.338782 Actual update 4200 of 5001, Stored update 4200 of 5001 -2 * Loglike = 9218.098365 Actual update 4250 of 5001, Stored update 4250 of 5001 -2 * Loglike = 9192.878156 Actual update 4300 of 5001, Stored update 4300 of 5001 -2 * Loglike = 9211.471250 Actual update 4350 of 5001, Stored update 4350 of 5001 -2 * Loglike = 9217.216161 Actual update 4400 of 5001, Stored update 4400 of 5001 -2 * Loglike = 9214.835575 Actual update 4450 of 5001, Stored update 4450 of 5001 -2 * Loglike = 9208.972779 Actual update 4500 of 5001, Stored update 4500 of 5001 -2 * Loglike = 9223.102763 Actual update 4550 of 5001, Stored update 4550 of 5001 -2 * Loglike = 9203.956845 Actual update 4600 of 5001, Stored update 4600 of 5001 -2 * Loglike = 9201.960121 Actual update 4650 of 5001, Stored update 4650 of 5001 -2 * Loglike = 9194.101999 Actual update 4700 of 5001, Stored update 4700 of 5001 -2 * Loglike = 9207.476225 Actual update 4750 of 5001, Stored update 4750 of 5001 -2 * Loglike = 9215.003009 Actual update 4800 of 5001, Stored update 4800 of 5001 -2 * Loglike = 9186.582930 Actual update 4850 of 5001, Stored update 4850 of 5001 -2 * Loglike = 9202.744286 Actual update 4900 of 5001, Stored update 4900 of 5001 -2 * Loglike = 9228.521835 Actual update 4950 of 5001, Stored update 4950 of 5001 -2 * Loglike = 9210.720494 Actual update 5000 of 5001, Stored update 5000 of 5001 -2 * Loglike = 9214.075214 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5001 Average = 9208.8 S.D. = 12.005 S.E.M. = 0.16976 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.05) multilevel model (Normal) N min mean max N_complete min_complete mean_complete max_complete school 65 2 62.44615 198 65 2 62.44615 198 Estimation algorithm: MCMC Elapsed time : 1.47s Number of obs: 4059 (from total 4059) Number of iter.: 5001 Chains: 1 Burn-in: 500 Bayesian Deviance Information Criterion (DIC) Dbar D(thetabar) pD DIC 9208.819 9148.972 59.847 9268.666 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + (1 | school) + (1 | student) Level 2: school Level 1: student --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept 0.00134 0.04216 0.03 0.9746 -0.07762 0.08519 208 standlrt 0.56331 0.01254 44.91 0 *** 0.53889 0.58799 4019 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 --------------------------------------------------------------------------------------------------- The random part estimates at the school level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.09732 0.02049 0.06441 0.14454 2983 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.56635 0.01269 0.54175 0.59205 5001 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > resi.chain2 <- mymodel6@resi.chains$resi_lev2 > sixway(resi.chain2[, 1, drop = FALSE], name = "u0_1") > > # 4.7 Comparing two schools . . . . . . . . . . . . . . . . . . . . . . . 54 > > dif <- resi.chain2[, 1] - resi.chain2[, 2] > sixway(dif, name = "dif") > prop <- (dif > 0) > mean(prop) [1] 0.1529694 > > # 4.8 Calculating ranks of schools . . . . . . . . . . . . . . . . . . . .55 > > u0rank <- apply(resi.chain2, 1, rank) > u0rankmn <- apply(u0rank, 1, mean) > u0ranklo <- apply(u0rank, 1, function(x) quantile(x, 0.025)) > u0rankmd <- apply(u0rank, 1, median) > u0rankhi <- apply(u0rank, 1, function(x) quantile(x, 0.975)) > > plot(1:65, u0rankmd, ylim = c(0.5, 65.5), pch = 15, xlab = "School", ylab = "Rank") > points(1:65, u0ranklo, pch = 24, bg = "grey") > points(1:65, u0rankhi, pch = 25, bg = "grey") > for (i in 1:65) lines(rep(i, 2), c(u0ranklo[i], u0rankhi[i])) > > ## common caterpillar plot > > rankno <- order(u0rankmn) > plot(1:65, u0rankmn[rankno], ylim = c(0.5, 65.5), pch = 15, xlab = "School", ylab = "Rank") > points(1:65, u0ranklo[rankno], pch = 24, bg = "grey") > points(1:65, u0rankhi[rankno], pch = 25, bg = "grey") > for (i in 1:65) lines(rep(i, 2), c(u0ranklo[rankno[i]], u0rankhi[rankno[i]])) > > # 4.9 Estimating a function of parameters . . . . . . . . . . . . . . . . 58 > estimates <- mymodel6@chains > isc <- estimates[, "RP2_var_Intercept"]/(estimates[, "RP2_var_Intercept"] + estimates[, "RP1_var_Intercept"]) > summary(isc) Iterations = 1:5001 Thinning interval = 1 Number of chains = 1 Sample size per chain = 5001 1. Empirical mean and standard deviation for each variable, plus standard error of the mean: Mean SD Naive SE Time-series SE 0.1459128 0.0260660 0.0003686 0.0004804 2. Quantiles for each variable: 2.5% 25% 50% 75% 97.5% 0.1015 0.1272 0.1434 0.1621 0.2036 > sixway(isc, "isc") > rm(mymodel6) > > # Chapter learning outcomes . . . . . . . . . . . . . . . . . . . . . . . 60 > > ## reinstate par settings > par(mypar) > > > ############################################################################ > > proc.time() user system elapsed 5.79 0.65 13.56