R version 4.4.1 (2024-06-14 ucrt) -- "Race for Your Life" Copyright (C) 2024 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.11/ 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.11) multilevel model (Multinomial) Estimation algorithm: MCMC Elapsed time : 8.68s 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.11) multilevel model (Multinomial) Estimation algorithm: MCMC Elapsed time : 23.95s 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.11) 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 : 2.34s 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.22993 0.31881 -13.27 3.564e-40 *** -4.85480 -3.60507 Intercept_Modern_reversible_method -1.74918 0.13254 -13.20 9.053e-40 *** -2.00894 -1.48941 Intercept_Traditional_method -2.72435 0.17870 -15.25 1.771e-52 *** -3.07460 -2.37410 lcOne_child_Sterilization 2.22528 0.33607 6.62 3.556e-11 *** 1.56660 2.88397 lcOne_child_Modern_reversible_method 0.77677 0.14252 5.45 5.032e-08 *** 0.49743 1.05611 lcOne_child_Traditional_method 0.74780 0.22595 3.31 0.0009345 *** 0.30494 1.19066 lcTwo_children_Sterilization 2.82706 0.32911 8.59 8.696e-18 *** 2.18201 3.47210 lcTwo_children_Modern_reversible_method 0.80669 0.15009 5.37 7.668e-08 *** 0.51252 1.10085 lcTwo_children_Traditional_method 1.15238 0.21935 5.25 1.492e-07 *** 0.72245 1.58230 lcThree_plus_Sterilization 2.79627 0.31262 8.94 3.734e-19 *** 2.18355 3.40900 lcThree_plus_Modern_reversible_method 0.33866 0.12964 2.61 0.008993 ** 0.08457 0.59275 lcThree_plus_Traditional_method 1.19256 0.18379 6.49 8.659e-11 *** 0.83234 1.55278 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.54357 0.15546 cov_Intercept_Sterilization_Intercept_Modern_reversible_method 0.31830 0.09994 var_Intercept_Modern_reversible_method 0.39513 0.10718 cov_Intercept_Sterilization_Intercept_Traditional_method 0.25275 0.09876 cov_Intercept_Modern_reversible_method_Intercept_Traditional_method 0.14217 0.07942 var_Intercept_Traditional_method 0.33141 0.11218 --------------------------------------------------------------------------------------------------- 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 = 5704.568882 Adapting for 200 iterations (Maximum 5000) -2 * Loglike = 5757.791526 Adapting for 300 iterations (Maximum 5000) -2 * Loglike = 5705.535069 Adapting for 400 iterations (Maximum 5000) -2 * Loglike = 5729.344254 Adapting for 500 iterations (Maximum 5000) -2 * Loglike = 5712.950157 Adapting for 600 iterations (Maximum 5000) -2 * Loglike = 5705.059901 Adapting for 700 iterations (Maximum 5000) -2 * Loglike = 5731.996229 Adapting for 800 iterations (Maximum 5000) -2 * Loglike = 5711.636932 Adapting for 900 iterations (Maximum 5000) -2 * Loglike = 5760.299166 Adapting for 1000 iterations (Maximum 5000) -2 * Loglike = 5718.446142 Adapting for 1100 iterations (Maximum 5000) -2 * Loglike = 5697.672688 Adapting finished and took 1200 iterations Adapting took 1200 iterations Burning in for 50 iterations out of 500 -2 * Loglike = 5709.142070 Burning in for 100 iterations out of 500 -2 * Loglike = 5739.972166 Burning in for 150 iterations out of 500 -2 * Loglike = 5714.670704 Burning in for 200 iterations out of 500 -2 * Loglike = 5766.279664 Burning in for 250 iterations out of 500 -2 * Loglike = 5731.873560 Burning in for 300 iterations out of 500 -2 * Loglike = 5731.830234 Burning in for 350 iterations out of 500 -2 * Loglike = 5728.221897 Burning in for 400 iterations out of 500 -2 * Loglike = 5739.834707 Burning in for 450 iterations out of 500 -2 * Loglike = 5720.125691 Burning in for 500 iterations out of 500 -2 * Loglike = 5704.400505 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.346666 Actual update 100 of 5000, Stored update 100 of 5000 -2 * Loglike = 5710.310912 Actual update 150 of 5000, Stored update 150 of 5000 -2 * Loglike = 5729.281555 Actual update 200 of 5000, Stored update 200 of 5000 -2 * Loglike = 5729.728787 Actual update 250 of 5000, Stored update 250 of 5000 -2 * Loglike = 5736.930612 Actual update 300 of 5000, Stored update 300 of 5000 -2 * Loglike = 5740.641589 Actual update 350 of 5000, Stored update 350 of 5000 -2 * Loglike = 5715.519119 Actual update 400 of 5000, Stored update 400 of 5000 -2 * Loglike = 5736.010875 Actual update 450 of 5000, Stored update 450 of 5000 -2 * Loglike = 5721.915353 Actual update 500 of 5000, Stored update 500 of 5000 -2 * Loglike = 5755.905426 Actual update 550 of 5000, Stored update 550 of 5000 -2 * Loglike = 5744.188829 Actual update 600 of 5000, Stored update 600 of 5000 -2 * Loglike = 5723.645240 Actual update 650 of 5000, Stored update 650 of 5000 -2 * Loglike = 5709.095458 Actual update 700 of 5000, Stored update 700 of 5000 -2 * Loglike = 5742.927352 Actual update 750 of 5000, Stored update 750 of 5000 -2 * Loglike = 5721.698563 Actual update 800 of 5000, Stored update 800 of 5000 -2 * Loglike = 5718.675242 Actual update 850 of 5000, Stored update 850 of 5000 -2 * Loglike = 5738.167447 Actual update 900 of 5000, Stored update 900 of 5000 -2 * Loglike = 5757.398646 Actual update 950 of 5000, Stored update 950 of 5000 -2 * Loglike = 5741.977961 Actual update 1000 of 5000, Stored update 1000 of 5000 -2 * Loglike = 5709.857246 Actual update 1050 of 5000, Stored update 1050 of 5000 -2 * Loglike = 5728.436569 Actual update 1100 of 5000, Stored update 1100 of 5000 -2 * Loglike = 5717.433190 Actual update 1150 of 5000, Stored update 1150 of 5000 -2 * Loglike = 5726.778107 Actual update 1200 of 5000, Stored update 1200 of 5000 -2 * Loglike = 5740.296073 Actual update 1250 of 5000, Stored update 1250 of 5000 -2 * Loglike = 5708.585419 Actual update 1300 of 5000, Stored update 1300 of 5000 -2 * Loglike = 5733.031032 Actual update 1350 of 5000, Stored update 1350 of 5000 -2 * Loglike = 5755.744866 Actual update 1400 of 5000, Stored update 1400 of 5000 -2 * Loglike = 5748.850833 Actual update 1450 of 5000, Stored update 1450 of 5000 -2 * Loglike = 5742.949506 Actual update 1500 of 5000, Stored update 1500 of 5000 -2 * Loglike = 5718.815748 Actual update 1550 of 5000, Stored update 1550 of 5000 -2 * Loglike = 5740.507647 Actual update 1600 of 5000, Stored update 1600 of 5000 -2 * Loglike = 5727.375264 Actual update 1650 of 5000, Stored update 1650 of 5000 -2 * Loglike = 5713.302045 Actual update 1700 of 5000, Stored update 1700 of 5000 -2 * Loglike = 5770.020002 Actual update 1750 of 5000, Stored update 1750 of 5000 -2 * Loglike = 5704.734121 Actual update 1800 of 5000, Stored update 1800 of 5000 -2 * Loglike = 5784.238119 Actual update 1850 of 5000, Stored update 1850 of 5000 -2 * Loglike = 5706.091334 Actual update 1900 of 5000, Stored update 1900 of 5000 -2 * Loglike = 5738.906362 Actual update 1950 of 5000, Stored update 1950 of 5000 -2 * Loglike = 5711.505558 Actual update 2000 of 5000, Stored update 2000 of 5000 -2 * Loglike = 5698.425973 Actual update 2050 of 5000, Stored update 2050 of 5000 -2 * Loglike = 5763.199035 Actual update 2100 of 5000, Stored update 2100 of 5000 -2 * Loglike = 5714.623608 Actual update 2150 of 5000, Stored update 2150 of 5000 -2 * Loglike = 5759.426798 Actual update 2200 of 5000, Stored update 2200 of 5000 -2 * Loglike = 5746.924834 Actual update 2250 of 5000, Stored update 2250 of 5000 -2 * Loglike = 5723.760437 Actual update 2300 of 5000, Stored update 2300 of 5000 -2 * Loglike = 5753.149193 Actual update 2350 of 5000, Stored update 2350 of 5000 -2 * Loglike = 5697.636147 Actual update 2400 of 5000, Stored update 2400 of 5000 -2 * Loglike = 5719.748658 Actual update 2450 of 5000, Stored update 2450 of 5000 -2 * Loglike = 5721.061391 Actual update 2500 of 5000, Stored update 2500 of 5000 -2 * Loglike = 5738.430671 Actual update 2550 of 5000, Stored update 2550 of 5000 -2 * Loglike = 5746.829924 Actual update 2600 of 5000, Stored update 2600 of 5000 -2 * Loglike = 5726.678751 Actual update 2650 of 5000, Stored update 2650 of 5000 -2 * Loglike = 5718.785403 Actual update 2700 of 5000, Stored update 2700 of 5000 -2 * Loglike = 5720.402180 Actual update 2750 of 5000, Stored update 2750 of 5000 -2 * Loglike = 5755.636970 Actual update 2800 of 5000, Stored update 2800 of 5000 -2 * Loglike = 5742.241221 Actual update 2850 of 5000, Stored update 2850 of 5000 -2 * Loglike = 5758.511402 Actual update 2900 of 5000, Stored update 2900 of 5000 -2 * Loglike = 5724.502586 Actual update 2950 of 5000, Stored update 2950 of 5000 -2 * Loglike = 5756.705736 Actual update 3000 of 5000, Stored update 3000 of 5000 -2 * Loglike = 5697.259510 Actual update 3050 of 5000, Stored update 3050 of 5000 -2 * Loglike = 5731.967310 Actual update 3100 of 5000, Stored update 3100 of 5000 -2 * Loglike = 5722.487847 Actual update 3150 of 5000, Stored update 3150 of 5000 -2 * Loglike = 5746.009329 Actual update 3200 of 5000, Stored update 3200 of 5000 -2 * Loglike = 5730.919160 Actual update 3250 of 5000, Stored update 3250 of 5000 -2 * Loglike = 5738.975589 Actual update 3300 of 5000, Stored update 3300 of 5000 -2 * Loglike = 5739.548976 Actual update 3350 of 5000, Stored update 3350 of 5000 -2 * Loglike = 5710.697865 Actual update 3400 of 5000, Stored update 3400 of 5000 -2 * Loglike = 5752.713740 Actual update 3450 of 5000, Stored update 3450 of 5000 -2 * Loglike = 5744.957174 Actual update 3500 of 5000, Stored update 3500 of 5000 -2 * Loglike = 5736.506288 Actual update 3550 of 5000, Stored update 3550 of 5000 -2 * Loglike = 5728.271557 Actual update 3600 of 5000, Stored update 3600 of 5000 -2 * Loglike = 5716.878936 Actual update 3650 of 5000, Stored update 3650 of 5000 -2 * Loglike = 5698.857165 Actual update 3700 of 5000, Stored update 3700 of 5000 -2 * Loglike = 5707.359663 Actual update 3750 of 5000, Stored update 3750 of 5000 -2 * Loglike = 5738.886747 Actual update 3800 of 5000, Stored update 3800 of 5000 -2 * Loglike = 5709.312478 Actual update 3850 of 5000, Stored update 3850 of 5000 -2 * Loglike = 5682.976364 Actual update 3900 of 5000, Stored update 3900 of 5000 -2 * Loglike = 5737.858435 Actual update 3950 of 5000, Stored update 3950 of 5000 -2 * Loglike = 5720.326920 Actual update 4000 of 5000, Stored update 4000 of 5000 -2 * Loglike = 5714.232004 Actual update 4050 of 5000, Stored update 4050 of 5000 -2 * Loglike = 5727.887047 Actual update 4100 of 5000, Stored update 4100 of 5000 -2 * Loglike = 5757.420265 Actual update 4150 of 5000, Stored update 4150 of 5000 -2 * Loglike = 5731.443757 Actual update 4200 of 5000, Stored update 4200 of 5000 -2 * Loglike = 5726.536832 Actual update 4250 of 5000, Stored update 4250 of 5000 -2 * Loglike = 5721.869593 Actual update 4300 of 5000, Stored update 4300 of 5000 -2 * Loglike = 5728.152088 Actual update 4350 of 5000, Stored update 4350 of 5000 -2 * Loglike = 5748.522657 Actual update 4400 of 5000, Stored update 4400 of 5000 -2 * Loglike = 5723.992623 Actual update 4450 of 5000, Stored update 4450 of 5000 -2 * Loglike = 5704.130545 Actual update 4500 of 5000, Stored update 4500 of 5000 -2 * Loglike = 5773.951296 Actual update 4550 of 5000, Stored update 4550 of 5000 -2 * Loglike = 5727.141171 Actual update 4600 of 5000, Stored update 4600 of 5000 -2 * Loglike = 5712.962592 Actual update 4650 of 5000, Stored update 4650 of 5000 -2 * Loglike = 5735.675402 Actual update 4700 of 5000, Stored update 4700 of 5000 -2 * Loglike = 5715.844424 Actual update 4750 of 5000, Stored update 4750 of 5000 -2 * Loglike = 5726.032900 Actual update 4800 of 5000, Stored update 4800 of 5000 -2 * Loglike = 5730.931617 Actual update 4850 of 5000, Stored update 4850 of 5000 -2 * Loglike = 5718.422784 Actual update 4900 of 5000, Stored update 4900 of 5000 -2 * Loglike = 5754.547350 Actual update 4950 of 5000, Stored update 4950 of 5000 -2 * Loglike = 5711.459420 Actual update 5000 of 5000, Stored update 5000 of 5000 -2 * Loglike = 5721.854020 PUPN c1003 c1004 AVER c1091 b99 b100 Count = 5000 Average = 5730.0 S.D. = 18.418 S.E.M. = 0.26047 ECHO 0 Execution completed -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MLwiN (version: 3.11) 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 : 31.52s 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 5729.992 5626.260 103.732 5833.724 --------------------------------------------------------------------------------------------------- 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.17107 0.28914 -14.43 3.554e-47 *** -4.68859 -3.60907 34 Intercept_Modern_reversible_method -1.72313 0.13372 -12.89 5.395e-38 *** -1.98428 -1.45081 105 Intercept_Traditional_method -2.73508 0.18316 -14.93 2.027e-50 *** -3.12417 -2.39455 84 lcOne_child_Sterilization 2.22597 0.29431 7.56 3.925e-14 *** 1.64695 2.80263 51 lcOne_child_Modern_reversible_method 0.79015 0.14276 5.53 3.116e-08 *** 0.51613 1.06361 333 lcOne_child_Traditional_method 0.80450 0.22354 3.60 0.0003195 *** 0.36635 1.24275 254 lcTwo_children_Sterilization 2.79260 0.29109 9.59 8.515e-22 *** 2.20379 3.35508 57 lcTwo_children_Modern_reversible_method 0.78407 0.15661 5.01 5.544e-07 *** 0.48859 1.09457 301 lcTwo_children_Traditional_method 1.15705 0.20712 5.59 2.318e-08 *** 0.74819 1.55665 285 lcThree_plus_Sterilization 2.73626 0.26925 10.16 2.915e-24 *** 2.20064 3.24717 40 lcThree_plus_Modern_reversible_method 0.31158 0.13075 2.38 0.01717 * 0.03472 0.57350 245 lcThree_plus_Traditional_method 1.21282 0.17953 6.76 1.425e-11 *** 0.85316 1.55874 133 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.60660 0.17310 0.34308 1.00881 463 cov_Intercept_Sterilization_Intercept_Modern_reversible_method 0.35926 0.12205 0.16564 0.63906 365 var_Intercept_Modern_reversible_method 0.44156 0.12427 0.25241 0.73246 356 cov_Intercept_Sterilization_Intercept_Traditional_method 0.30031 0.11579 0.10721 0.55786 412 cov_Intercept_Modern_reversible_method_Intercept_Traditional_method 0.17124 0.09098 0.01490 0.37124 331 var_Intercept_Traditional_method 0.38595 0.13498 0.18536 0.71113 274 --------------------------------------------------------------------------------------------------- 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.694 0.621 [2,] 0.694 1.000 0.415 [3,] 0.621 0.415 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.17 0.70 73.51