MCMC manual example ordered - why not define pupil level?
Posted: Thu Jan 25, 2018 10:03 am
I am attempting to use ordered logistic regression using R2MLwiN.
As a first step, I am looking at the R2MLwiN script for the MCMC manual example.
In chapter 13.3, pupil is set as the level 1 identifier.
In the R2MLwiN script, pupil is not included:
It seems like ID (I guess row number) is automatically included.
However, if I do include 1|pupil:
This means all variances and co-variances between the different levels of a_point are added.
Model results model without pupil level
Could you indicate what this (seeming) difference between the MCMC manual means?
As a first step, I am looking at the R2MLwiN script for the MCMC manual example.
In chapter 13.3, pupil is set as the level 1 identifier.
In the R2MLwiN script, pupil is not included:
Code: Select all
##IGLS
(mymodel <- runMLwiN(logit(a_point, cons, 6) ~ 1, D = "Ordered Multinomial", data = alevchem))
##MCMC
(mymodel <- runMLwiN(logit(a_point, cons, 6) ~ 1, D = "Ordered Multinomial", estoptions = list(EstM = 1), data = alevchem))
However, if I do include 1|pupil:
Code: Select all
(mymodel <- runMLwiN(logit(a_point, cons, 6) ~ 1 + (1|pupil), D = "Ordered Multinomial", estoptions = list(EstM = 1), data = alevchem))
Model results model without pupil level
Model with pupil level-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
MLwiN (version: 3) multilevel model (Multinomial)
Estimation algorithm: MCMC Elapsed time : 8.34s
Number of obs: 2166 (from total 2166) Number of iter.: 5000 Chains: 1 Burn-in: 500
Bayesian Deviance Information Criterion (DIC)
Dbar D(thetabar) pD DIC
7726.511 7721.406 5.105 7731.616
---------------------------------------------------------------------------------------------------
The model formula:
logit(a_point, cons, 6) ~ 1
Level 1: l1id
---------------------------------------------------------------------------------------------------
The fixed part estimates:
Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS
Intercept_F -1.40012 0.05613 -24.94 2.5e-137 *** -1.51127 -1.29510 194
Intercept_E -0.70183 0.04716 -14.88 4.28e-50 *** -0.79881 -0.61232 188
Intercept_D -0.09934 0.04498 -2.21 0.02721 * -0.19176 -0.01388 147
Intercept_C 0.59527 0.04602 12.94 2.84e-38 *** 0.49961 0.68032 223
Intercept_B 1.60622 0.05901 27.22 3.769e-163 *** 1.49184 1.71996 300
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
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
I guess this is because the intercept for each level of a_level is now estimated as a random effect?-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
MLwiN (version: 3) multilevel model (Multinomial)
N min mean max N_complete min_complete mean_complete max_complete
pupil 2166 1 1 1 2166 1 1 1
Estimation algorithm: MCMC Elapsed time : 43.97s
Number of obs: 2166 (from total 2166) Number of iter.: 5000 Chains: 1 Burn-in: 500
Bayesian Deviance Information Criterion (DIC)
Dbar D(thetabar) pD DIC
395.703 6.869 388.834 784.537
---------------------------------------------------------------------------------------------------
The model formula:
logit(a_point, cons, 6) ~ 1 + (1 | pupil)
Level 2: pupil Level 1: l1id
---------------------------------------------------------------------------------------------------
The fixed part estimates:
Coef. Std. Err. z Pr(>|z|) [95% Cred. Interval] ESS
Intercept_F 4.10627 0.77486 5.30 1.162e-07 *** 2.63315 5.49263 5
Intercept_E -2.07582 0.73007 -2.84 0.004465 ** -3.34374 -0.55136 40
Intercept_D -0.08980 0.45459 -0.20 0.8434 -0.93367 0.79449 32
Intercept_C 0.76966 0.54693 1.41 0.1594 -0.24859 1.89895 54
Intercept_B -1.74902 0.39295 -4.45 8.547e-06 *** -2.51739 -1.03183 28
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
---------------------------------------------------------------------------------------------------
The random part estimates at the pupil level:
Coef. Std. Err. [95% Cred. Interval] ESS
var_Intercept_(<=F) 103.12492 29.09328 58.88461 148.32300 1
cov_Intercept_(<=F)_Intercept_(<=E) -138.47910 26.94363 -179.05003 -92.21360 2
var_Intercept_(<=E) 196.79711 21.77792 152.69915 232.73954 4
cov_Intercept_(<=F)_Intercept_(<=D) 112.58096 26.81816 70.51030 148.04280 2
cov_Intercept_(<=E)_Intercept_(<=D) -156.13967 22.02502 -185.28259 -114.11827 2
var_Intercept_(<=D) 128.01792 24.27222 87.30998 167.62291 2
cov_Intercept_(<=F)_Intercept_(<=C) -165.09744 47.75515 -228.09562 -77.90900 1
cov_Intercept_(<=E)_Intercept_(<=C) 230.86870 45.27959 132.52153 287.67009 2
cov_Intercept_(<=D)_Intercept_(<=C) -186.69272 43.27639 -237.53872 -103.20750 2
var_Intercept_(<=C) 279.32319 75.09943 126.07002 362.58575 2
cov_Intercept_(<=F)_Intercept_(<=B) 105.01538 26.68246 62.48251 150.54072 2
cov_Intercept_(<=E)_Intercept_(<=B) -147.05840 21.62267 -185.23004 -104.85445 3
cov_Intercept_(<=D)_Intercept_(<=B) 120.01872 24.17397 82.77014 172.18165 2
cov_Intercept_(<=C)_Intercept_(<=B) -176.62759 40.04559 -243.33494 -100.78991 2
var_Intercept_(<=B) 116.30997 26.09783 82.89570 180.51572 3
---------------------------------------------------------------------------------------------------
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
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Could you indicate what this (seeming) difference between the MCMC manual means?