R version 4.5.1 (2025-06-13 ucrt) -- "Great Square Root" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 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. 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 > # > # 12 Unordered Categorical Responses . . . . . . . . . . . . . . . . . .167 > # > # 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.15/ 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) > > # Change contrasts if wish to avoid warning indicating that, by default, > # specified contrasts for ordered predictors will be ignored by runMLwiN > # (they will be fitted as "contr.treatment" regardless of this setting). To > # enable specified contrasts, set allowcontrast to TRUE (this will be the > # default in future package releases). NB at the end of this script, the > # specification for contrasts is changed back. > my_contrasts <- options("contrasts")$contrasts > options(contrasts = c(unordered = "contr.treatment", + ordered = "contr.treatment")) > > # As an alternative to changing contrasts, can instead use C() to specify > # contrasts for ordered predictors in formula object, e.g.: > > # (mymodel <- runMLwiN(log(use4) ~ 1 + C(lc, "contr.treatment"), > # D = "Unordered Multinomial", > # estoptions = list(EstM = 1), > # data = bang, > # allowcontrast = TRUE)) > > ## Read bang data > data(bang, package = "R2MLwiN") > > bang$use4 <- relevel(bang$use4, 4) > > # 12.1 Fitting a first single-level multinomial model . . . . . . . . . .169 > > (mymodel <- runMLwiN(log(use4) ~ 1, D = "Unordered Multinomial", estoptions = list(EstM = 1), data = bang)) 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 iteration 6 iteration 7 Convergence achieved ECHO 0 Echoing is ON MCMC 0 500 1 5.8 50 10 G30[1] G30[2] 2 2 2 1 1 6 RUNNING ADAPTIVE PROCEDURE AND BURNING IN... Adapting for 100 iterations (Maximum 5000) -2 * Loglike = 6244.031734 Adapting for 200 iterations (Maximum 5000) -2 * Loglike = 6243.061097 Adapting for 300 iterations (Maximum 5000) -2 * Loglike = 6241.508099 Adapting finished and took 400 iterations Adapting took 400 iterations Burning in for 50 iterations out of 500 -2 * Loglike = 6246.659558 Burning in for 100 iterations out of 500 -2 * Loglike = 6241.996374 Burning in for 150 iterations out of 500 -2 * Loglike = 6242.992434 Burning in for 200 iterations out of 500 -2 * Loglike = 6241.000772 Burning in for 250 iterations out of 500 -2 * Loglike = 6245.693239 Burning in for 300 iterations out of 500 -2 * Loglike = 6243.237478 Burning in for 350 iterations out of 500 -2 * Loglike = 6240.877923 Burning in for 400 iterations out of 500 -2 * Loglike = 6244.094381 Burning in for 450 iterations out of 500 -2 * Loglike = 6241.685610 Burning in for 500 iterations out of 500 -2 * Loglike = 6239.926321 ERAS G30 LINK 0 G30 ERAS c1090 c1091 MCMC 1 5000 1 c1090 c1091 c1003 c1004 1 6 Actual update 50 of 5000, Stored update 50 of 5000 -2 * Loglike = 6242.847714 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 6240.971003 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 6240.200614 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 6240.790226 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 6246.548794 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 6245.932858 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 6240.938999 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 6247.706232 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 6242.407922 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 6242.052826 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 6240.318068 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 6244.310782 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 6247.445990 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 6240.652007 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 6240.603384 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 6241.260432 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 6240.422643 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 6247.940452 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 6243.943495 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 6240.025113 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 6244.513941 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 6245.822420 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 6240.966137 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 6240.822605 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 6243.953862 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 6240.535047 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 6243.883686 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 6242.940633 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 6246.246007 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 6242.207775 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 6240.632888 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 6246.047158 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 6241.084290 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 6240.058486 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 6243.907303 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 6243.047598 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 6247.125683 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 6244.124216 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 6240.392967 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 6241.708128 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 6241.213495 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 6242.821192 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 6243.714840 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 6241.468000 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 6244.488592 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 6242.202333 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 6242.213249 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 6242.950302 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 6240.693079 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 6240.828339 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 6241.567291 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 6242.841888 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 6243.172669 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 6240.092064 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 6241.120236 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 6240.597850 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 6242.238127 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 6245.497703 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 6245.938634 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 6242.025444 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 6241.314773 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 6242.415621 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 6246.803903 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 6242.689243 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 6240.644909 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 6247.506481 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 6240.345652 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 6245.729944 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 6243.675185 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 6240.722281 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 6245.583016 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 6241.790073 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 6241.421633 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 6240.185416 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 6243.174853 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 6240.107113 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 6241.223685 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 6247.664672 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 6242.070811 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 6242.582915 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 6241.793230 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 6240.467422 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 6246.909315 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 6241.567784 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 6242.561150 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 6247.393146 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 6248.199220 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 6240.856421 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 6240.031749 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 6243.999404 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 6245.201292 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 6241.975053 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 6243.421649 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 6240.123743 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 6241.199944 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 6242.197424 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 6240.093358 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 6240.486330 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 6239.988462 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 6243.373291 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 6242.8 S.D. = 2.4467 S.E.M. = 0.034602 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.15) multilevel model (Multinomial) Estimation algorithm: MCMC Elapsed time : 9.28s Number of obs: 2867 (from total 2867) Number of iter.: 5000 Chains: 1 Burn-in: 500 Bayesian Deviance Information Criterion (DIC) Dbar D(thetabar) pD DIC 6242.821 6239.805 3.016 6245.838 --------------------------------------------------------------------------------------------------- The model formula: log(use4) ~ 1 Level 1: l1id --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept_Sterilization -1.74851 0.06318 -27.68 1.323e-168 *** -1.87624 -1.62648 1012 Intercept_Modern_reversible_method -1.13878 0.04897 -23.26 1.225e-119 *** -1.23472 -1.04071 963 Intercept_Traditional_method -1.81607 0.06411 -28.33 1.635e-176 *** -1.94120 -1.69018 1059 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 --------------------------------------------------------------------------------------------------- The random part estimates at the l1id level: Coef. Std. Err. [95% Cred. Interval] ESS bcons_1 1.00000 1e-05 1.00000 1.00000 5000 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > cat(paste("Pr(y = 1) =", round(exp(mymodel@FP["FP_Intercept_Sterilization"])/(1 + exp(mymodel@FP["FP_Intercept_Sterilization"]) + exp(mymodel@FP["FP_Intercept_Modern_reversible_method"]) + + exp(mymodel@FP["FP_Intercept_Traditional_method"])), 4), "\n")) Pr(y = 1) = 0.105 > cat(paste("Pr(y = 2) =", round(exp(mymodel@FP["FP_Intercept_Modern_reversible_method"])/(1 + exp(mymodel@FP["FP_Intercept_Sterilization"]) + exp(mymodel@FP["FP_Intercept_Modern_reversible_method"]) + + exp(mymodel@FP["FP_Intercept_Traditional_method"])), 4), "\n")) Pr(y = 2) = 0.1933 > cat(paste("Pr(y = 3) =", round(exp(mymodel@FP["FP_Intercept_Traditional_method"])/(1 + exp(mymodel@FP["FP_Intercept_Sterilization"]) + exp(mymodel@FP["FP_Intercept_Modern_reversible_method"]) + + exp(mymodel@FP["FP_Intercept_Traditional_method"])), 4), "\n")) Pr(y = 3) = 0.0982 > > # 12.2 Adding predictor variables . . . . . . . . . . . . . . . . . . . .173 > > (mymodel <- runMLwiN(log(use4) ~ 1 + lc, D = "Unordered Multinomial", estoptions = list(EstM = 1), data = bang)) 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 iteration 6 iteration 7 iteration 8 iteration 9 Convergence achieved ECHO 0 Echoing is ON MCMC 0 500 1 5.8 50 10 G30[1] G30[2] 2 2 2 1 1 6 RUNNING ADAPTIVE PROCEDURE AND BURNING IN... Adapting for 100 iterations (Maximum 5000) -2 * Loglike = 6041.579437 Adapting for 200 iterations (Maximum 5000) -2 * Loglike = 6049.012774 Adapting for 300 iterations (Maximum 5000) -2 * Loglike = 6038.215433 Adapting for 400 iterations (Maximum 5000) -2 * Loglike = 6033.095801 Adapting for 500 iterations (Maximum 5000) -2 * Loglike = 6052.131151 Adapting for 600 iterations (Maximum 5000) -2 * Loglike = 6039.717430 Adapting for 700 iterations (Maximum 5000) -2 * Loglike = 6036.568153 Adapting for 800 iterations (Maximum 5000) -2 * Loglike = 6038.696597 Adapting for 900 iterations (Maximum 5000) -2 * Loglike = 6040.377300 Adapting finished and took 1000 iterations Adapting took 1000 iterations Burning in for 50 iterations out of 500 -2 * Loglike = 6035.686905 Burning in for 100 iterations out of 500 -2 * Loglike = 6033.377809 Burning in for 150 iterations out of 500 -2 * Loglike = 6035.073254 Burning in for 200 iterations out of 500 -2 * Loglike = 6040.682245 Burning in for 250 iterations out of 500 -2 * Loglike = 6038.189932 Burning in for 300 iterations out of 500 -2 * Loglike = 6041.968960 Burning in for 350 iterations out of 500 -2 * Loglike = 6041.079758 Burning in for 400 iterations out of 500 -2 * Loglike = 6034.052399 Burning in for 450 iterations out of 500 -2 * Loglike = 6033.056486 Burning in for 500 iterations out of 500 -2 * Loglike = 6038.487352 ERAS G30 LINK 0 G30 ERAS c1090 c1091 MCMC 1 5000 1 c1090 c1091 c1003 c1004 1 6 Actual update 50 of 5000, Stored update 50 of 5000 -2 * Loglike = 6038.494814 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 6049.127483 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 6034.855139 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 6060.577767 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 6036.744791 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 6035.533740 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 6038.659099 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 6039.418209 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 6037.245270 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 6042.852643 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 6039.053810 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 6037.244715 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 6044.295206 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 6033.839942 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 6054.551025 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 6036.303709 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 6044.788967 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 6043.860345 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 6035.877478 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 6038.674711 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 6038.714131 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 6044.673502 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 6039.059086 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 6041.834922 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 6040.161186 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 6036.439359 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 6040.411820 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 6037.975643 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 6035.761843 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 6040.897942 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 6035.665729 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 6036.030757 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 6034.128778 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 6040.839484 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 6035.755795 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 6037.638091 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 6036.243326 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 6033.753273 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 6035.560002 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 6033.717771 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 6032.634455 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 6040.125060 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 6041.248930 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 6035.806475 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 6047.959187 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 6040.308567 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 6036.009617 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 6037.421307 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 6038.254351 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 6039.804584 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 6040.245255 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 6043.975669 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 6039.920806 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 6031.314282 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 6035.827326 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 6040.702106 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 6047.501514 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 6043.564972 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 6035.605867 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 6034.133063 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 6037.213149 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 6037.400697 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 6040.580926 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 6038.401290 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 6042.873300 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 6037.605864 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 6043.145708 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 6036.334299 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 6029.622493 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 6046.252807 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 6036.058770 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 6038.711550 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 6038.984527 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 6033.861853 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 6037.316773 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 6041.475019 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 6041.617970 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 6036.196848 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 6050.328764 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 6037.838841 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 6044.444692 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 6040.792549 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 6043.673143 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 6035.117584 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 6039.443912 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 6041.382659 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 6035.667035 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 6041.623387 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 6036.997822 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 6037.395503 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 6042.715116 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 6032.412075 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 6034.373645 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 6042.547341 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 6031.060277 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 6044.876073 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 6038.338887 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 6044.145712 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 6042.020356 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 6043.128360 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 6039.8 S.D. = 4.8857 S.E.M. = 0.069094 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.15) multilevel model (Multinomial) Estimation algorithm: MCMC Elapsed time : 24.53s Number of obs: 2867 (from total 2867) Number of iter.: 5000 Chains: 1 Burn-in: 500 Bayesian Deviance Information Criterion (DIC) Dbar D(thetabar) pD DIC 6039.758 6027.915 11.844 6051.602 --------------------------------------------------------------------------------------------------- The model formula: log(use4) ~ 1 + lc Level 1: l1id --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept_Sterilization -3.92924 0.28282 -13.89 6.962e-44 *** -4.55466 -3.44516 30 Intercept_Modern_reversible_method -1.47662 0.09789 -15.08 2.039e-51 *** -1.68104 -1.28860 172 Intercept_Traditional_method -2.62693 0.15019 -17.49 1.686e-68 *** -2.91870 -2.33993 107 lcOne_child_Sterilization 2.22671 0.32762 6.80 1.071e-11 *** 1.63688 2.93656 40 lcOne_child_Modern_reversible_method 0.74308 0.14148 5.25 1.504e-07 *** 0.45856 1.01790 264 lcOne_child_Traditional_method 0.77772 0.21454 3.62 0.000289 *** 0.36507 1.18555 209 lcTwo_children_Sterilization 2.70312 0.32024 8.44 3.152e-17 *** 2.11865 3.37176 42 lcTwo_children_Modern_reversible_method 0.69550 0.14990 4.64 3.486e-06 *** 0.40090 0.99251 253 lcTwo_children_Traditional_method 1.10762 0.21389 5.18 2.238e-07 *** 0.68423 1.52550 206 lcThree_plus_Sterilization 2.61557 0.29285 8.93 4.21e-19 *** 2.10129 3.26153 35 lcThree_plus_Modern_reversible_method 0.21164 0.13420 1.58 0.1148 -0.05306 0.47830 203 lcThree_plus_Traditional_method 1.14562 0.17855 6.42 1.398e-10 *** 0.79797 1.49604 103 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 --------------------------------------------------------------------------------------------------- The random part estimates at the l1id level: Coef. Std. Err. [95% Cred. Interval] ESS bcons_1 1.00000 1e-05 1.00000 1.00000 5000 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > > cat(paste("Pr(y = 3) =", round(exp(mymodel@FP["FP_Intercept_Traditional_method"])/(1 + exp(mymodel@FP["FP_Intercept_Sterilization"]) + exp(mymodel@FP["FP_Intercept_Modern_reversible_method"]) + + exp(mymodel@FP["FP_Intercept_Traditional_method"])), 4), "\n")) Pr(y = 3) = 0.0548 > cat(paste("Pr(y = 3) =", round(exp(mymodel@FP["FP_Intercept_Traditional_method"] + mymodel@FP["FP_lcTwo_children_Traditional_method"])/(1 + exp(mymodel@FP["FP_Intercept_Sterilization"] + + mymodel@FP["FP_lcTwo_children_Sterilization"]) + exp(mymodel@FP["FP_Intercept_Modern_reversible_method"] + mymodel@FP["FP_lcTwo_children_Modern_reversible_method"]) + exp(mymodel@FP["FP_Intercept_Traditional_method"] + + mymodel@FP["FP_lcTwo_children_Traditional_method"])), 4), "\n")) Pr(y = 3) = 0.1111 > > # 12.3 Interval estimates for conditional probabilities . . . . . . . . .175 > > chains <- mymodel@chains > pred1 <- exp(chains[, "FP_Intercept_Traditional_method"])/(1 + exp(chains[, "FP_Intercept_Sterilization"]) + exp(chains[, "FP_Intercept_Modern_reversible_method"]) + + exp(chains[, "FP_Intercept_Traditional_method"])) > summary(pred1) Iterations = 1:5000 Thinning interval = 1 Number of chains = 1 Sample size per chain = 5000 1. Empirical mean and standard deviation for each variable, plus standard error of the mean: Mean SD Naive SE Time-series SE 0.055211 0.007851 0.000111 0.000742 2. Quantiles for each variable: 2.5% 25% 50% 75% 97.5% 0.04138 0.04956 0.05483 0.06031 0.07150 > sixway(pred1, "prob1") > > pred2 <- exp(chains[, "FP_Intercept_Traditional_method"] + chains[, "FP_lcTwo_children_Traditional_method"])/(1 + exp(chains[, "FP_Intercept_Sterilization"] + chains[, + "FP_lcTwo_children_Sterilization"]) + exp(chains[, "FP_Intercept_Modern_reversible_method"] + chains[, "FP_lcTwo_children_Modern_reversible_method"]) + exp(chains[, "FP_Intercept_Traditional_method"] + + chains[, "FP_lcTwo_children_Traditional_method"])) > summary(pred2) Iterations = 1:5000 Thinning interval = 1 Number of chains = 1 Sample size per chain = 5000 1. Empirical mean and standard deviation for each variable, plus standard error of the mean: Mean SD Naive SE Time-series SE 0.1116646 0.0143970 0.0002036 0.0003978 2. Quantiles for each variable: 2.5% 25% 50% 75% 97.5% 0.08435 0.10167 0.11135 0.12075 0.14125 > sixway(pred2, "prob1") > > # 12.4 Adding district level random effects . . . . . . . . . . . . . . .177 > > ## Uses IGLS > (mymodel <- runMLwiN(log(use4) ~ 1 + lc + (1 | district), D = "Unordered Multinomial", estoptions = list(EstM = 0, + nonlinear = c(1, 2)), data = bang)) /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 iteration 4 iteration 5 iteration 6 iteration 7 iteration 8 iteration 9 iteration 10 iteration 11 Convergence achieved ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.15) multilevel model (Multinomial) N min mean max N_complete min_complete mean_complete max_complete district 60 3 47.78333 173 60 3 47.78333 173 Estimation algorithm: IGLS PQL2 Elapsed time : 3.36s Number of obs: 2867 (from total 2867) The model converged after 12 iterations. Log likelihood: NA Deviance statistic: NA --------------------------------------------------------------------------------------------------- The model formula: log(use4) ~ 1 + lc + (1 | district) Level 2: district Level 1: l1id --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Conf. Interval] Intercept_Sterilization -4.22620 0.31857 -13.27 3.645e-40 *** -4.85059 -3.60180 Intercept_Modern_reversible_method -1.74559 0.13217 -13.21 7.94e-40 *** -2.00463 -1.48655 Intercept_Traditional_method -2.72194 0.17843 -15.25 1.533e-52 *** -3.07167 -2.37222 lcOne_child_Sterilization 2.22260 0.33617 6.61 3.801e-11 *** 1.56373 2.88147 lcOne_child_Modern_reversible_method 0.77363 0.14245 5.43 5.605e-08 *** 0.49444 1.05282 lcOne_child_Traditional_method 0.74557 0.22595 3.30 0.0009678 *** 0.30272 1.18843 lcTwo_children_Sterilization 2.81860 0.32921 8.56 1.111e-17 *** 2.17336 3.46383 lcTwo_children_Modern_reversible_method 0.79902 0.15007 5.32 1.013e-07 *** 0.50489 1.09316 lcTwo_children_Traditional_method 1.14592 0.21942 5.22 1.765e-07 *** 0.71587 1.57597 lcThree_plus_Sterilization 2.79095 0.31266 8.93 4.403e-19 *** 2.17814 3.40377 lcThree_plus_Modern_reversible_method 0.33331 0.12959 2.57 0.01011 * 0.07931 0.58730 lcThree_plus_Traditional_method 1.18849 0.18377 6.47 9.972e-11 *** 0.82832 1.54867 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 --------------------------------------------------------------------------------------------------- The random part estimates at the district level: Coef. Std. Err. var_Intercept_Sterilization 0.53443 0.15371 cov_Intercept_Sterilization_Intercept_Modern_reversible_method 0.31161 0.09876 var_Intercept_Modern_reversible_method 0.39094 0.10632 cov_Intercept_Sterilization_Intercept_Traditional_method 0.24584 0.09763 cov_Intercept_Modern_reversible_method_Intercept_Traditional_method 0.13773 0.07870 var_Intercept_Traditional_method 0.32716 0.11132 --------------------------------------------------------------------------------------------------- The random part estimates at the l1id level: Coef. Std. Err. bcons_1 1.00000 0.00000 bcons_2 1.00000 0.00000 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- Warning message: In runMLwiN(log(use4) ~ 1 + lc + (1 | district), D = "Unordered Multinomial", : You specified as log link, but a logit link has been fitted > > ## Uses MCMC > (mymodel <- runMLwiN(log(use4) ~ 1 + lc + (1 | district), D = "Unordered Multinomial", estoptions = list(EstM = 1, + nonlinear = c(1, 2)), data = bang)) 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 iteration 6 iteration 7 iteration 8 iteration 9 iteration 10 iteration 11 Convergence achieved ECHO 0 Echoing is ON MCMC 0 500 1 5.8 50 10 G30[1] G30[2] 2 2 2 1 1 6 RUNNING ADAPTIVE PROCEDURE AND BURNING IN... Adapting for 100 iterations (Maximum 5000) -2 * Loglike = 5685.987927 Adapting for 200 iterations (Maximum 5000) -2 * Loglike = 5769.473093 Adapting for 300 iterations (Maximum 5000) -2 * Loglike = 5728.762170 Adapting for 400 iterations (Maximum 5000) -2 * Loglike = 5722.370291 Adapting for 500 iterations (Maximum 5000) -2 * Loglike = 5718.074685 Adapting for 600 iterations (Maximum 5000) -2 * Loglike = 5727.697174 Adapting for 700 iterations (Maximum 5000) -2 * Loglike = 5738.178904 Adapting for 800 iterations (Maximum 5000) -2 * Loglike = 5758.228453 Adapting for 900 iterations (Maximum 5000) -2 * Loglike = 5710.019780 Adapting finished and took 1000 iterations Adapting took 1000 iterations Burning in for 50 iterations out of 500 -2 * Loglike = 5713.043258 Burning in for 100 iterations out of 500 -2 * Loglike = 5738.002793 Burning in for 150 iterations out of 500 -2 * Loglike = 5741.655980 Burning in for 200 iterations out of 500 -2 * Loglike = 5711.860591 Burning in for 250 iterations out of 500 -2 * Loglike = 5757.989364 Burning in for 300 iterations out of 500 -2 * Loglike = 5731.198215 Burning in for 350 iterations out of 500 -2 * Loglike = 5754.220619 Burning in for 400 iterations out of 500 -2 * Loglike = 5691.424699 Burning in for 450 iterations out of 500 -2 * Loglike = 5722.100989 Burning in for 500 iterations out of 500 -2 * Loglike = 5724.254800 ERAS G30 LINK 0 G30 ERAS c1090 c1091 MCMC 1 5000 1 c1090 c1091 c1003 c1004 1 6 Actual update 50 of 5000, Stored update 50 of 5000 -2 * Loglike = 5716.964908 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 5732.143795 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 5727.673391 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 5728.873180 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 5723.213468 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 5692.013801 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 5754.731417 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 5786.348778 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 5751.593259 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 5706.174962 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 5750.263488 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 5738.334618 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 5721.445382 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 5714.136670 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 5703.972620 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 5729.577955 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 5723.237723 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 5721.290162 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 5703.518715 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 5740.105406 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 5729.011898 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 5737.264290 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 5691.923602 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 5729.674440 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 5751.113581 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 5735.936339 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 5752.283108 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 5712.790158 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 5710.133300 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 5717.967814 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 5734.644356 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 5726.096156 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 5719.477765 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 5743.914966 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 5728.875155 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 5707.409784 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 5714.341819 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 5699.097695 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 5707.061024 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 5741.414856 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 5716.417265 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 5742.471031 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 5731.728726 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 5726.084942 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 5734.932850 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 5723.499666 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 5762.054223 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 5738.470431 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 5733.352920 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 5717.739249 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 5748.873171 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 5710.823007 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 5709.801730 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 5761.294920 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 5708.090861 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 5721.776945 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 5733.874225 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 5729.520492 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 5715.782396 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 5736.465756 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 5740.248751 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 5716.957488 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 5730.609129 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 5720.593267 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 5729.200373 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 5712.765308 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 5720.154939 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 5718.800239 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 5739.915340 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 5738.566848 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 5733.837943 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 5711.599529 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 5741.271659 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 5722.622197 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 5727.350275 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 5720.645362 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 5711.285523 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 5744.373436 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 5719.381548 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 5727.505010 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 5746.280000 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 5742.738470 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 5731.414938 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 5755.074541 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 5704.819944 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 5747.346786 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 5707.822275 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 5708.578370 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 5747.917854 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 5729.680554 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 5743.659878 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 5747.323298 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 5710.908973 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 5722.481630 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 5739.690907 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 5783.656555 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 5703.121013 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 5761.116261 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 5752.832676 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 5741.872801 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 5730.4 S.D. = 18.604 S.E.M. = 0.26309 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.15) multilevel model (Multinomial) N min mean max N_complete min_complete mean_complete max_complete district 60 3 47.78333 173 60 3 47.78333 173 Estimation algorithm: MCMC Elapsed time : 32.72s Number of obs: 2867 (from total 2867) Number of iter.: 5000 Chains: 1 Burn-in: 500 Bayesian Deviance Information Criterion (DIC) Dbar D(thetabar) pD DIC 5730.357 5625.246 105.112 5835.469 --------------------------------------------------------------------------------------------------- The model formula: log(use4) ~ 1 + lc + (1 | district) Level 2: district Level 1: l1id --------------------------------------------------------------------------------------------------- The fixed part estimates: Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS Intercept_Sterilization -4.24189 0.30632 -13.85 1.306e-43 *** -4.92033 -3.71358 28 Intercept_Modern_reversible_method -1.72038 0.14702 -11.70 1.248e-31 *** -1.98873 -1.42341 67 Intercept_Traditional_method -2.69706 0.17628 -15.30 7.711e-53 *** -3.05317 -2.37306 80 lcOne_child_Sterilization 2.30573 0.32912 7.01 2.455e-12 *** 1.72478 2.98779 55 lcOne_child_Modern_reversible_method 0.79300 0.15359 5.16 2.428e-07 *** 0.49240 1.08745 186 lcOne_child_Traditional_method 0.77677 0.23387 3.32 0.0008958 *** 0.30827 1.22669 244 lcTwo_children_Sterilization 2.87643 0.32472 8.86 8.141e-19 *** 2.29808 3.56173 42 lcTwo_children_Modern_reversible_method 0.79271 0.16581 4.78 1.746e-06 *** 0.46758 1.10633 259 lcTwo_children_Traditional_method 1.13729 0.21590 5.27 1.382e-07 *** 0.73398 1.56841 148 lcThree_plus_Sterilization 2.82205 0.31048 9.09 9.975e-20 *** 2.27815 3.46390 40 lcThree_plus_Modern_reversible_method 0.31858 0.13831 2.30 0.02126 * 0.05260 0.59280 198 lcThree_plus_Traditional_method 1.18512 0.18554 6.39 1.685e-10 *** 0.83165 1.54957 119 Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 --------------------------------------------------------------------------------------------------- The random part estimates at the district level: Coef. Std. Err. [95% Cred. Interval] ESS var_Intercept_Sterilization 0.61540 0.17579 0.33642 1.03290 308 cov_Intercept_Sterilization_Intercept_Modern_reversible_method 0.36156 0.12058 0.16275 0.64242 457 var_Intercept_Modern_reversible_method 0.43967 0.12337 0.24570 0.72891 486 cov_Intercept_Sterilization_Intercept_Traditional_method 0.30677 0.12050 0.10314 0.57514 357 cov_Intercept_Modern_reversible_method_Intercept_Traditional_method 0.16783 0.09600 0.00152 0.37693 381 var_Intercept_Traditional_method 0.39943 0.13547 0.19715 0.71973 283 --------------------------------------------------------------------------------------------------- The random part estimates at the l1id level: Coef. Std. Err. [95% Cred. Interval] ESS bcons_1 1.00000 1e-05 1.00000 1.00000 5000 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- > sixway(mymodel@chains[, "RP2_var_Intercept_Sterilization", drop = FALSE], "sigma2v0") > > RP3.cons <- matrix(, 3, 3) > RP3.cons[upper.tri(RP3.cons, diag = TRUE)] <- mymodel@RP[1:6] > RP3.cons[lower.tri(RP3.cons)] <- RP3.cons[upper.tri(RP3.cons)] > round(cov2cor(RP3.cons), 3) [,1] [,2] [,3] [1,] 1.000 0.695 0.619 [2,] 0.695 1.000 0.400 [3,] 0.619 0.400 1.000 > > # Chapter learning outcomes . . . . . . . . . . . . . . . . . . . . . . .128 > > # Addendum: changing contrasts back to pre-existing . . . . . . . . . . . NA > > # Following re-specification of contrast settings towards the start of this > # script, change contrasts back to pre-existing: > options(contrasts = my_contrasts) > > ############################################################################ > > proc.time() user system elapsed 5.01 2.01 78.96