R version 4.3.2 (2023-10-31 ucrt) -- "Eye Holes" Copyright (C) 2023 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 > # > # 9 Modelling Complex Variance at Level 1 / Heteroscedasticity. . . . .111 > # > # 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-2024 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.09/ 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) > > # User's input if necessary > > ## Read tutorial data > data(tutorial, package = "R2MLwiN") > > boy.normexam <- tutorial$normexam[which(tutorial$sex == "boy")] > girl.normexam <- tutorial$normexam[which(tutorial$sex == "girl")] > tab1 <- cbind(c(length(boy.normexam), mean(boy.normexam), sd(boy.normexam)), c(length(girl.normexam), mean(girl.normexam), + sd(girl.normexam)), c(length(tutorial$normexam), mean(tutorial$normexam), sd(tutorial$normexam))) > colnames(tab1) <- c("0", "1", "TOTAL") > rownames(tab1) <- c("N", "MEANS", "SDs") > formatC(round(tab1, 6)) 0 1 TOTAL N "1623" "2436" "4059" MEANS "-0.1404" "0.09332" "-0.000114" SDs "1.026" "0.9697" "0.9989" > > c5 <- tutorial$standlrt > intakecat <- rep(0, length(c5)) > intakecat[which(c5 > -1)] <- 1 > intakecat[which(c5 > -0.5)] <- 2 > intakecat[which(c5 > -0.1)] <- 3 > intakecat[which(c5 > 0.3)] <- 4 > intakecat[which(c5 > 0.7)] <- 5 > intakecat[which(c5 > 1.1)] <- 6 > normexam <- tutorial$normexam > tab2 <- cbind(c(sum(intakecat == 0), mean(normexam[intakecat == 0]), sd(normexam[intakecat == 0])), c(sum(intakecat == + 1), mean(normexam[intakecat == 1]), sd(normexam[intakecat == 1])), c(sum(intakecat == 2), mean(normexam[intakecat == + 2]), sd(normexam[intakecat == 2])), c(sum(intakecat == 3), mean(normexam[intakecat == 3]), sd(normexam[intakecat == + 3])), c(sum(intakecat == 4), mean(normexam[intakecat == 4]), sd(normexam[intakecat == 4])), c(sum(intakecat == + 5), mean(normexam[intakecat == 5]), sd(normexam[intakecat == 5])), c(sum(intakecat == 6), mean(normexam[intakecat == + 6]), sd(normexam[intakecat == 6])), c(length(intakecat), mean(normexam), sd(normexam))) > colnames(tab2) <- c("0", "1", "2", "3", "4", "5", "6", "TOTAL") > rownames(tab2) <- c("N", "MEANS", "SDs") > formatC(round(tab2, 6)) 0 1 2 3 4 5 6 N "612" "594" "619" "710" "547" "428" "549" MEANS "-0.887" "-0.4988" "-0.1908" "0.04392" "0.2785" "0.571" "0.9633" SDs "0.8548" "0.7743" "0.8065" "0.8112" "0.8118" "0.8235" "0.8382" TOTAL N "4059" MEANS "-0.000114" SDs "0.9989" > > # 9.1 MCMC algorithm for a 1 level Normal model with complex variation . 113 > > # 9.2 Setting up the model in MLwiN . . . . . . . . . . . . . . . . . . .115 > > ## The highest level comes first, then the second highest and so on > ## Fit the model > (mymodel1 <- runMLwiN(normexam ~ 1 + standlrt + (1 + standlrt | 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 Convergence achieved ECHO 0 Echoing is ON MCMC 0 500 1 5.8 50 10 1 1 1 1 1 1 RUNNING ADAPTIVE PROCEDURE AND BURNING IN... Adapting for 100 iterations (Maximum 5000) -2 * Loglike = 9766.499969 Adapting for 200 iterations (Maximum 5000) -2 * Loglike = 9760.691193 Adapting for 300 iterations (Maximum 5000) -2 * Loglike = 9763.396134 Adapting finished and took 400 iterations Adapting took 400 iterations Burning in for 50 iterations out of 500 -2 * Loglike = 9762.204676 Burning in for 100 iterations out of 500 -2 * Loglike = 9766.695431 Burning in for 150 iterations out of 500 -2 * Loglike = 9764.610102 Burning in for 200 iterations out of 500 -2 * Loglike = 9764.749995 Burning in for 250 iterations out of 500 -2 * Loglike = 9762.418763 Burning in for 300 iterations out of 500 -2 * Loglike = 9769.068382 Burning in for 350 iterations out of 500 -2 * Loglike = 9766.374447 Burning in for 400 iterations out of 500 -2 * Loglike = 9763.134076 Burning in for 450 iterations out of 500 -2 * Loglike = 9763.584333 Burning in for 500 iterations out of 500 -2 * Loglike = 9767.212546 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 = 9762.079610 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 9762.533507 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 9766.943996 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 9768.609816 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 9769.493465 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 9778.315751 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 9765.810385 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 9760.652864 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 9761.044100 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 9763.215978 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 9760.352547 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 9767.501440 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 9760.517234 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 9763.011238 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 9762.939873 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 9760.749485 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 9765.009841 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 9768.532779 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 9767.420925 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 9771.098732 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 9769.264123 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 9761.175337 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 9760.614338 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 9765.007348 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 9766.603156 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 9763.289638 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 9766.744080 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 9760.835772 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 9763.521102 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 9764.441843 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 9769.415393 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 9768.271667 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 9762.616886 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 9763.365448 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 9767.008996 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 9762.729040 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 9765.427403 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 9761.214979 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 9765.582994 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 9763.211991 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 9770.349020 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 9761.793153 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 9762.590922 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 9762.525152 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 9760.414653 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 9765.083295 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 9765.397386 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 9764.511084 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 9764.280025 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 9768.763982 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 9767.165864 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 9761.929896 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 9761.228934 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 9764.362783 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 9760.888619 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 9761.164369 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 9766.137012 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 9764.110567 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 9763.492263 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 9766.714804 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 9767.451871 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 9763.164055 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 9765.553907 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 9765.219323 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 9762.061486 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 9762.844864 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 9762.489898 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 9761.647777 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 9770.629363 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 9765.865037 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 9760.625037 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 9764.485725 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 9760.495316 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 9760.768488 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 9767.501945 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 9765.275615 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 9760.689301 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 9761.229924 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 9765.990761 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 9762.714872 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 9761.061858 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 9762.234497 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 9769.859004 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 9762.003690 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 9761.347557 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 9762.959081 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 9762.557707 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 9762.620705 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 9762.953659 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 9761.743284 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 9763.010072 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 9762.496540 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 9765.461805 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 9760.736841 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 9760.336194 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 9767.376729 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 9763.680613 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 9762.504236 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 9761.593670 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 9771.679148 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 9764.4 S.D. = 3.1553 S.E.M. = 0.044623 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.09) multilevel model (Normal) Estimation algorithm: MCMC Elapsed time : 3.25s 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 9764.430 9759.606 4.824 9769.254 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + (1 + standlrt | student) Level 1: student --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept -0.00185 0.01245 -0.15 0.8817 -0.02598 0.02212 4741 standlrt 0.59572 0.01306 45.63 0 *** 0.57049 0.62155 4727 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.63855 0.01758 0.60523 0.67506 462 cov_Intercept_standlrt 0.00273 0.00734 -0.01144 0.01689 896 var_standlrt 0.01204 0.01087 -0.00764 0.03429 489 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > trajectories(mymodel1, Range = c(4501, 5000)) > > l1varfn <- mymodel1@RP["RP1_var_Intercept"] + 2 * mymodel1@RP["RP1_cov_Intercept_standlrt"] * tutorial$standlrt + + mymodel1@RP["RP1_var_standlrt"] * tutorial$standlrt^2 > plot(sort(tutorial$standlrt), l1varfn[order(tutorial$standlrt)], xlab = "standlrt", ylab = "l1varfn", type = "l") > abline(v = 0, lty = "dotted") > > # 9.3 Complex variance functions in multilevel models . . . . . . . . . .119 > > ## The highest level comes first, then the second highest and so on Choose option(s) for inference Fit the model > (mymodel2 <- runMLwiN(normexam ~ 1 + standlrt + (1 + standlrt | 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... Burning in for 50 iterations out of 500 -2 * Loglike = 9136.615416 Burning in for 100 iterations out of 500 -2 * Loglike = 9129.472590 Burning in for 150 iterations out of 500 -2 * Loglike = 9137.752388 Burning in for 200 iterations out of 500 -2 * Loglike = 9149.641457 Burning in for 250 iterations out of 500 -2 * Loglike = 9113.737768 Burning in for 300 iterations out of 500 -2 * Loglike = 9127.854908 Burning in for 350 iterations out of 500 -2 * Loglike = 9099.670195 Burning in for 400 iterations out of 500 -2 * Loglike = 9107.133017 Burning in for 450 iterations out of 500 -2 * Loglike = 9108.686421 Burning in for 500 iterations out of 500 -2 * Loglike = 9142.796685 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 = 9114.789855 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 9128.936360 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 9120.626663 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 9140.221260 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 9133.366931 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 9112.633267 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 9110.267312 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 9134.271816 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 9146.903828 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 9118.578020 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 9132.630258 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 9105.115711 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 9126.654041 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 9138.820724 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 9119.239813 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 9145.879653 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 9132.483550 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 9094.657080 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 9118.502105 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 9094.902922 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 9135.645832 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 9128.926707 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 9104.509733 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 9108.989181 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 9111.759420 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 9103.538840 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 9120.142978 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 9117.533977 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 9114.717113 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 9118.929584 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 9146.845851 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 9126.654978 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 9127.854549 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 9114.945398 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 9156.130168 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 9134.732656 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 9142.867734 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 9137.471434 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 9127.702153 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 9133.939751 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 9107.640871 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 9137.519015 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 9147.472132 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 9104.767457 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 9118.396071 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 9143.494727 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 9130.468641 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 9137.527730 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 9106.747459 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 9154.348069 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 9142.340919 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 9100.831693 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 9131.653716 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 9151.916582 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 9165.855130 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 9125.508254 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 9146.519009 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 9122.524343 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 9128.808395 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 9125.880481 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 9130.006670 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 9116.446060 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 9105.444348 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 9141.749060 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 9122.819747 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 9140.592905 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 9119.521430 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 9137.983211 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 9128.855413 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 9130.638160 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 9119.619021 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 9124.980114 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 9135.552922 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 9127.477138 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 9114.227379 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 9110.953194 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 9118.839082 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 9118.763419 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 9117.590737 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 9106.053640 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 9112.274103 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 9115.311806 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 9122.276612 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 9120.226668 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 9140.403968 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 9153.535294 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 9117.253885 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 9116.415887 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 9136.007855 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 9119.650550 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 9108.406619 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 9104.027872 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 9104.517145 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 9102.506754 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 9125.791725 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 9121.949129 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 9123.201133 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 9116.574595 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 9120.080554 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 9120.628553 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 9123.2 S.D. = 16.792 S.E.M. = 0.23747 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.09) 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 : 2.15s 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 9123.206 9031.714 91.492 9214.698 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + (1 + standlrt | 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.01257 0.04089 -0.31 0.7585 -0.09055 0.06865 209 standlrt 0.55645 0.02084 26.70 4.362e-157 *** 0.51501 0.59701 596 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.09711 0.02001 0.06465 0.14261 2549 cov_Intercept_standlrt 0.01933 0.00739 0.00660 0.03537 1740 var_standlrt 0.01526 0.00485 0.00772 0.02662 846 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.55440 0.01242 0.53052 0.57904 4750 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > l2varfn <- mymodel2@RP["RP2_var_Intercept"] + 2 * mymodel2@RP["RP2_cov_Intercept_standlrt"] * tutorial$standlrt + + mymodel2@RP["RP2_var_standlrt"] * tutorial$standlrt^2 > l1varfn <- mymodel2@RP["RP1_var_Intercept"] > plot(sort(tutorial$standlrt), l2varfn[order(tutorial$standlrt)], xlab = "standlrt", ylab = "varfns", ylim = c(0, 0.6), + type = "l") > abline(h = l1varfn) > abline(v = 0, lty = "dotted") > > ## Fit the model > (mymodel3 <- runMLwiN(normexam ~ 1 + standlrt + (1 + standlrt | school) + (1 + standlrt | 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 iteration 4 iteration 5 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 RUNNING ADAPTIVE PROCEDURE AND BURNING IN... Adapting for 100 iterations (Maximum 5000) -2 * Loglike = 9099.632934 Adapting for 200 iterations (Maximum 5000) -2 * Loglike = 9095.234121 Adapting for 300 iterations (Maximum 5000) -2 * Loglike = 9108.040574 Adapting for 400 iterations (Maximum 5000) -2 * Loglike = 9125.246080 Adapting finished and took 500 iterations Adapting took 500 iterations Burning in for 50 iterations out of 500 -2 * Loglike = 9105.739182 Burning in for 100 iterations out of 500 -2 * Loglike = 9113.485562 Burning in for 150 iterations out of 500 -2 * Loglike = 9092.874934 Burning in for 200 iterations out of 500 -2 * Loglike = 9109.755154 Burning in for 250 iterations out of 500 -2 * Loglike = 9119.910247 Burning in for 300 iterations out of 500 -2 * Loglike = 9086.997679 Burning in for 350 iterations out of 500 -2 * Loglike = 9107.980832 Burning in for 400 iterations out of 500 -2 * Loglike = 9133.947281 Burning in for 450 iterations out of 500 -2 * Loglike = 9106.969321 Burning in for 500 iterations out of 500 -2 * Loglike = 9103.596289 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 = 9127.616499 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 9100.808560 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 9124.332854 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 9140.096016 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 9171.123648 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 9141.850163 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 9118.271170 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 9140.173895 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 9110.659839 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 9125.076865 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 9136.596904 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 9132.968316 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 9127.312966 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 9139.073098 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 9108.130448 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 9120.083361 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 9121.172264 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 9118.406431 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 9144.695696 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 9116.176756 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 9146.287322 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 9102.292531 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 9136.648477 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 9098.317507 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 9104.528163 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 9139.208287 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 9136.234359 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 9105.588858 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 9109.132080 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 9108.510277 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 9131.558765 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 9121.293185 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 9108.148543 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 9128.067069 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 9129.750022 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 9136.442452 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 9135.198710 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 9140.086758 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 9128.330397 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 9142.069765 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 9112.930534 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 9125.532425 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 9116.841342 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 9117.998366 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 9133.844159 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 9135.382316 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 9115.577983 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 9088.626800 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 9139.488496 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 9173.677234 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 9113.240980 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 9111.222010 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 9121.141361 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 9127.820948 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 9099.945782 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 9128.556103 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 9128.655378 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 9105.369381 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 9103.756617 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 9131.855493 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 9125.998920 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 9146.792035 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 9119.719090 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 9112.898974 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 9112.663987 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 9147.198103 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 9114.181102 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 9157.262076 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 9125.431521 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 9142.301209 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 9144.172385 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 9128.173175 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 9120.700767 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 9108.198774 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 9125.692288 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 9100.992755 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 9110.241273 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 9105.221843 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 9107.465510 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 9144.282125 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 9137.613624 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 9113.791798 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 9113.441099 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 9099.415205 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 9119.878468 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 9120.360589 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 9073.038481 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 9154.508347 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 9122.778401 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 9124.207274 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 9131.881672 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 9105.804092 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 9108.154598 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 9134.577604 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 9107.856253 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 9123.489794 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 9115.203120 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 9112.917831 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 9132.513391 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 9123.435109 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 9121.0 S.D. = 16.890 S.E.M. = 0.23886 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.09) 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 : 5.63s 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 9120.983 9028.659 92.323 9213.306 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + (1 + standlrt | school) + (1 + standlrt | student) Level 2: school Level 1: student --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept -0.01113 0.03879 -0.29 0.7743 -0.08856 0.06789 215 standlrt 0.55863 0.01948 28.68 7.142e-181 *** 0.52010 0.59578 724 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.09672 0.01988 0.06447 0.14035 3077 cov_Intercept_standlrt 0.01963 0.00741 0.00670 0.03601 1538 var_standlrt 0.01492 0.00468 0.00768 0.02559 851 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.55327 0.01513 0.52425 0.58360 564 cov_Intercept_standlrt -0.01477 0.00654 -0.02761 -0.00134 1022 var_standlrt 0.00215 0.00892 -0.01438 0.02091 560 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > ## Remove term standlrt/standlrt from the level 1 covariance matrix > clre <- matrix(, nrow = 3, ncol = 1) > clre[1, 1] <- 1 > clre[2, 1] <- "standlrt" > clre[3, 1] <- "standlrt" > > ## Fit the model > (mymodel4 <- runMLwiN(normexam ~ 1 + standlrt + (1 + standlrt | school) + (1 + standlrt | student), estoptions = list(EstM = 1, + clre = clre), 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 RUNNING ADAPTIVE PROCEDURE AND BURNING IN... Adapting for 100 iterations (Maximum 5000) -2 * Loglike = 9103.608537 Adapting for 200 iterations (Maximum 5000) -2 * Loglike = 9104.794384 Adapting for 300 iterations (Maximum 5000) -2 * Loglike = 9106.587808 Adapting finished and took 400 iterations Adapting took 400 iterations Burning in for 50 iterations out of 500 -2 * Loglike = 9084.012286 Burning in for 100 iterations out of 500 -2 * Loglike = 9141.372249 Burning in for 150 iterations out of 500 -2 * Loglike = 9139.924757 Burning in for 200 iterations out of 500 -2 * Loglike = 9147.919590 Burning in for 250 iterations out of 500 -2 * Loglike = 9112.965804 Burning in for 300 iterations out of 500 -2 * Loglike = 9134.813097 Burning in for 350 iterations out of 500 -2 * Loglike = 9126.493198 Burning in for 400 iterations out of 500 -2 * Loglike = 9132.058349 Burning in for 450 iterations out of 500 -2 * Loglike = 9110.128490 Burning in for 500 iterations out of 500 -2 * Loglike = 9122.485183 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 = 9113.827004 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 9120.344774 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 9131.571748 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 9122.675089 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 9109.400100 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 9083.311268 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 9099.539189 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 9110.952384 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 9098.254055 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 9112.838223 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 9119.123120 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 9107.725474 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 9137.566142 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 9127.469372 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 9133.232775 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 9109.845660 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 9104.634721 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 9116.117349 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 9131.814804 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 9103.069871 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 9124.351722 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 9127.129672 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 9119.558083 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 9130.582940 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 9135.941001 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 9114.183876 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 9103.545768 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 9136.561307 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 9116.921294 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 9138.400180 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 9100.716722 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 9116.150103 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 9114.982774 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 9093.000974 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 9101.102749 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 9124.873918 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 9118.299658 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 9106.783387 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 9130.420897 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 9091.230699 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 9126.291871 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 9123.904320 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 9130.713719 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 9108.373348 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 9100.333375 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 9096.674412 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 9107.961560 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 9124.296642 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 9115.375578 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 9107.832295 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 9086.485266 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 9086.334257 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 9102.834515 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 9087.637119 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 9146.131898 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 9147.761211 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 9144.639618 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 9101.821107 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 9116.112986 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 9142.605812 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 9103.559125 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 9100.487145 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 9114.395407 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 9112.983182 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 9107.293014 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 9117.535013 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 9109.291518 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 9124.974215 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 9091.478123 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 9121.507439 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 9139.082276 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 9101.265442 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 9095.316154 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 9129.938008 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 9132.250234 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 9141.292142 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 9138.141800 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 9098.604112 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 9130.551409 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 9101.352643 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 9127.468174 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 9124.600038 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 9106.285622 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 9110.730618 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 9132.395836 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 9112.423021 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 9093.589587 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 9112.306785 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 9098.915403 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 9122.868776 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 9107.372921 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 9105.571833 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 9099.547815 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 9106.817675 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 9104.380929 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 9121.932768 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 9108.100616 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 9129.336859 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 9117.824475 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 9133.520562 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 9118.9 S.D. = 16.764 S.E.M. = 0.23708 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.09) 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 : 4.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 9118.930 9027.486 91.444 9210.375 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + (1 + standlrt | school) + (1 + standlrt | student) Level 2: school Level 1: student --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept -0.01652 0.04238 -0.39 0.6968 -0.10004 0.06424 201 standlrt 0.55661 0.02069 26.90 2.234e-159 *** 0.51697 0.59685 665 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.09740 0.02001 0.06503 0.14251 2668 cov_Intercept_standlrt 0.02026 0.00741 0.00720 0.03639 1601 var_standlrt 0.01534 0.00459 0.00810 0.02572 923 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.55609 0.01235 0.53182 0.58156 1206 cov_Intercept_standlrt -0.01496 0.00635 -0.02760 -0.00301 899 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > # 9.4 Relationship with gender . . . . . . . . . . . . . . . . . . . . . 123 > > tutorial$girl <- as.integer(tutorial$sex) - 1 > > ## Remove term standlrt/standlrt and girl/girl from the level 1 covariance matrix > clre <- matrix(, nrow = 3, ncol = 2) > clre[1, 1] <- 1 > clre[2, 1] <- "standlrt" > clre[3, 1] <- "standlrt" > clre[1, 2] <- 1 > clre[2, 2] <- "girl" > clre[3, 2] <- "girl" > > (mymodel5 <- runMLwiN(normexam ~ 1 + standlrt + girl + (1 + standlrt | school) + (1 + standlrt + girl | student), + estoptions = list(EstM = 1, clre = clre), 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 RUNNING ADAPTIVE PROCEDURE AND BURNING IN... Adapting for 100 iterations (Maximum 5000) -2 * Loglike = 9110.921196 Adapting for 200 iterations (Maximum 5000) -2 * Loglike = 9067.047034 Adapting for 300 iterations (Maximum 5000) -2 * Loglike = 9066.447766 Adapting for 400 iterations (Maximum 5000) -2 * Loglike = 9061.376957 Adapting finished and took 500 iterations Adapting took 500 iterations Burning in for 50 iterations out of 500 -2 * Loglike = 9124.001759 Burning in for 100 iterations out of 500 -2 * Loglike = 9077.859505 Burning in for 150 iterations out of 500 -2 * Loglike = 9064.900895 Burning in for 200 iterations out of 500 -2 * Loglike = 9093.705697 Burning in for 250 iterations out of 500 -2 * Loglike = 9110.246177 Burning in for 300 iterations out of 500 -2 * Loglike = 9091.414712 Burning in for 350 iterations out of 500 -2 * Loglike = 9129.468588 Burning in for 400 iterations out of 500 -2 * Loglike = 9067.771448 Burning in for 450 iterations out of 500 -2 * Loglike = 9076.249530 Burning in for 500 iterations out of 500 -2 * Loglike = 9112.539637 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 = 9109.441602 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 9090.422079 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 9071.175973 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 9077.353111 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 9075.501213 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 9081.689949 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 9093.284882 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 9070.820963 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 9081.675736 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 9075.932203 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 9054.041060 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 9081.479172 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 9092.010277 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 9113.444057 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 9106.311211 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 9048.691686 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 9081.451283 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 9088.175631 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 9090.571763 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 9084.208026 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 9053.899192 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 9105.029614 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 9077.990293 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 9109.843943 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 9073.546170 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 9104.987083 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 9051.624287 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 9095.823029 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 9085.213635 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 9097.600879 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 9061.804961 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 9079.527365 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 9096.816295 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 9120.389673 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 9113.120148 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 9078.905991 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 9103.846688 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 9105.149997 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 9070.717474 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 9091.035945 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 9074.052266 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 9067.193953 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 9082.591146 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 9081.899722 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 9101.348857 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 9076.064207 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 9056.630332 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 9096.711090 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 9091.716613 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 9116.488536 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 9056.518589 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 9092.519940 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 9114.347284 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 9067.723578 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 9064.182703 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 9094.947224 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 9106.551782 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 9123.947813 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 9070.667462 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 9092.636405 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 9080.711677 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 9093.806902 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 9048.962438 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 9076.323723 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 9071.930033 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 9056.644116 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 9118.885631 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 9063.212911 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 9089.217762 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 9102.912147 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 9122.683629 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 9079.149034 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 9115.194344 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 9089.251553 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 9092.762311 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 9092.979223 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 9082.110834 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 9073.710397 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 9046.340427 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 9080.561444 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 9077.465145 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 9076.748862 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 9080.497809 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 9084.648608 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 9086.241051 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 9078.416276 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 9061.218142 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 9078.185988 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 9073.149276 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 9089.791408 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 9102.255345 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 9062.224030 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 9071.012282 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 9082.055753 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 9087.572831 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 9093.210045 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 9112.740200 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 9103.127892 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 9069.234890 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 9052.042819 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 9084.8 S.D. = 17.343 S.E.M. = 0.24527 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.09) 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 : 7s 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 9084.784 8991.147 93.638 9178.422 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + girl + (1 + standlrt | school) + (1 + standlrt + girl | student) Level 2: school Level 1: student --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept -0.10748 0.04345 -2.47 0.01337 * -0.18925 -0.01782 230 standlrt 0.55535 0.02041 27.21 4.552e-163 *** 0.51455 0.59535 467 girl 0.17549 0.03235 5.43 5.785e-08 *** 0.11132 0.23867 1794 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.09217 0.01903 0.06117 0.13576 3143 cov_Intercept_standlrt 0.02078 0.00723 0.00827 0.03659 1643 var_standlrt 0.01551 0.00475 0.00806 0.02631 893 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.58687 0.02009 0.55016 0.62641 260 cov_Intercept_standlrt -0.03377 0.00974 -0.05235 -0.01430 263 cov_Intercept_girl -0.02973 0.01279 -0.05668 -0.00572 269 cov_standlrt_girl 0.03226 0.01247 0.00791 0.05657 273 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > l2varfn <- mymodel5@RP["RP2_var_Intercept"] + 2 * mymodel5@RP["RP2_cov_Intercept_standlrt"] * tutorial$standlrt + + mymodel5@RP["RP2_var_standlrt"] * tutorial$standlrt^2 > l1varfnboys <- mymodel5@RP["RP1_var_Intercept"] + 2 * mymodel5@RP["RP1_cov_Intercept_standlrt"] * tutorial$standlrt > l1varfngirls <- mymodel5@RP["RP1_var_Intercept"] + 2 * mymodel5@RP["RP1_cov_Intercept_standlrt"] * tutorial$standlrt + + 2 * mymodel5@RP["RP1_cov_Intercept_girl"] + 2 * mymodel5@RP["RP1_cov_standlrt_girl"] * tutorial$standlrt > plot(sort(tutorial$standlrt), l2varfn[order(tutorial$standlrt)], xlab = "standlrt", ylab = "varfns", ylim = c(0, 0.8), + type = "l") > lines(sort(tutorial$standlrt), l1varfnboys[order(tutorial$standlrt)]) > lines(sort(tutorial$standlrt), l1varfngirls[order(tutorial$standlrt)]) > abline(v = 0, lty = "dotted") > > # 9.5 Alternative log precision formulation . . . . . . . . . . . . . . .126 > > (mymodel6 <- runMLwiN(normexam ~ 1 + standlrt + girl + (1 + standlrt | school) + (1 + standlrt + girl | student), + estoptions = list(EstM = 1, clre = clre, mcmcMeth = list(lclo = 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 RUNNING ADAPTIVE PROCEDURE AND BURNING IN... Adapting for 100 iterations (Maximum 5000) -2 * Loglike = 9071.607665 Adapting for 200 iterations (Maximum 5000) -2 * Loglike = 9057.435736 Adapting finished and took 300 iterations Adapting took 300 iterations Burning in for 50 iterations out of 500 -2 * Loglike = 9081.145444 Burning in for 100 iterations out of 500 -2 * Loglike = 9095.321762 Burning in for 150 iterations out of 500 -2 * Loglike = 9081.767979 Burning in for 200 iterations out of 500 -2 * Loglike = 9084.489028 Burning in for 250 iterations out of 500 -2 * Loglike = 9117.683002 Burning in for 300 iterations out of 500 -2 * Loglike = 9076.173678 Burning in for 350 iterations out of 500 -2 * Loglike = 9086.357099 Burning in for 400 iterations out of 500 -2 * Loglike = 9071.482363 Burning in for 450 iterations out of 500 -2 * Loglike = 9101.989220 Burning in for 500 iterations out of 500 -2 * Loglike = 9090.600550 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 = 9038.877398 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 9089.530247 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 9130.096619 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 9091.853893 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 9102.319059 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 9087.969842 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 9082.357312 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 9081.005283 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 9102.545164 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 9082.449441 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 9079.699415 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 9112.255740 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 9074.152343 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 9066.515330 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 9070.486740 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 9073.502814 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 9084.108359 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 9072.075290 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 9063.883258 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 9069.678222 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 9085.038716 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 9065.067694 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 9070.473029 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 9099.935038 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 9085.441751 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 9080.501962 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 9075.678308 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 9070.491287 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 9068.604256 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 9093.037544 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 9083.115979 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 9086.563486 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 9099.717911 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 9080.093201 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 9118.474318 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 9087.668810 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 9089.845693 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 9079.390599 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 9078.541589 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 9060.052507 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 9074.099706 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 9095.174384 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 9067.108592 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 9089.900970 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 9100.632668 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 9093.757378 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 9083.762573 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 9090.360921 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 9116.536864 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 9076.415490 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 9096.960905 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 9070.411601 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 9074.555075 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 9075.215433 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 9080.850771 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 9062.190956 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 9098.711168 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 9114.355793 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 9063.171673 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 9082.151592 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 9055.118453 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 9079.305726 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 9076.177301 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 9085.017116 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 9079.686487 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 9115.303961 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 9101.767043 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 9103.755484 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 9062.894988 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 9094.214127 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 9060.678721 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 9061.683134 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 9099.394638 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 9086.181211 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 9063.805610 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 9064.333526 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 9067.335725 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 9065.833301 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 9094.501616 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 9120.973075 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 9100.812824 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 9079.303021 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 9105.741798 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 9089.288527 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 9073.236320 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 9095.297416 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 9089.099875 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 9114.863946 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 9086.506897 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 9107.759461 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 9095.931245 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 9099.030241 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 9107.259082 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 9112.847385 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 9089.495614 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 9075.627534 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 9088.741093 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 9078.614947 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 9086.408920 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 9076.916867 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 9084.8 S.D. = 16.891 S.E.M. = 0.23888 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.09) 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 : 9.51s 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 9084.850 8991.299 93.551 9178.401 --------------------------------------------------------------------------------------------------- The model formula: normexam ~ 1 + standlrt + girl + (1 + standlrt | school) + (1 + standlrt + girl | student) Level 2: school Level 1: student --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept -0.11328 0.04646 -2.44 0.01477 * -0.20356 -0.02398 197 standlrt 0.55263 0.02077 26.61 5.463e-156 *** 0.51190 0.59357 478 girl 0.17578 0.03139 5.60 2.154e-08 *** 0.11402 0.23831 1959 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.09311 0.01928 0.06243 0.13820 2688 cov_Intercept_standlrt 0.02101 0.00712 0.00887 0.03665 1763 var_standlrt 0.01568 0.00465 0.00818 0.02626 827 --------------------------------------------------------------------------------------------------- The random part estimates at the student level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept 0.54296 0.03417 0.47895 0.61279 331 cov_Intercept_standlrt 0.05343 0.01795 0.01877 0.08898 328 cov_Intercept_girl 0.04945 0.02167 0.00661 0.09159 319 cov_standlrt_girl -0.04945 0.02325 -0.09629 -0.00448 300 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > l2varfn <- mymodel6@RP["RP2_var_Intercept"] + 2 * mymodel6@RP["RP2_cov_Intercept_standlrt"] * tutorial$standlrt + + mymodel6@RP["RP2_var_standlrt"] * tutorial$standlrt^2 > l1varfnboys <- 1/exp(mymodel6@RP["RP1_var_Intercept"] + 2 * mymodel6@RP["RP1_cov_Intercept_standlrt"] * tutorial$standlrt) > l1varfngirls <- 1/exp(mymodel6@RP["RP1_var_Intercept"] + 2 * mymodel6@RP["RP1_cov_Intercept_standlrt"] * tutorial$standlrt + + 2 * mymodel6@RP["RP1_cov_Intercept_girl"] + 2 * mymodel6@RP["RP1_cov_standlrt_girl"] * tutorial$standlrt) > plot(sort(tutorial$standlrt), l2varfn[order(tutorial$standlrt)], xlab = "standlrt", ylab = "varfns", ylim = c(0, 0.8), + type = "l") > lines(sort(tutorial$standlrt), l1varfnboys[order(tutorial$standlrt)]) > lines(sort(tutorial$standlrt), l1varfngirls[order(tutorial$standlrt)]) > abline(v = 0, lty = "dotted") > > # Chapter learning outcomes . . . . . . . . . . . . . . . . . . . . . . .128 > > > > > > ############################################################################ > > proc.time() user system elapsed 5.51 0.85 39.93