[R-sig-ME] lme4 to MCMCglmm

Wincent ronggui.huang at gmail.com
Mon Jan 3 03:14:50 CET 2011


Dear all, recently I have been reading on MCMCglmm, trying to fit a
cross-classified mixed model. I believe lme4 and MCMCglmm can fit
similar models (sure, the two packages are different). Here is an
example from mlmRev. As Dave suggested, the article at Journal of
Statistical Software is a good starting point.

> library(mlmRev)
> m1 <- lmer(attain~sex+(1|primary)+(1|second),data=ScotsSec)
> m1
Linear mixed model fit by REML
Formula: attain ~ sex + (1 | primary) + (1 | second)
   Data: ScotsSec
   AIC   BIC logLik deviance REMLdev
 17138 17169  -8564    17123   17128
Random effects:
 Groups   Name        Variance Std.Dev.
 primary  (Intercept) 1.10962  1.0534
 second   (Intercept) 0.36966  0.6080
 Residual             8.05511  2.8382
Number of obs: 3435, groups: primary, 148; second, 19

Fixed effects:
            Estimate Std. Error t value
(Intercept)  5.25515    0.18432  28.511
sexF         0.49852    0.09825   5.074

Correlation of Fixed Effects:
     (Intr)
sexF -0.264

> library(MCMCglmm)
> m2 <- MCMCglmm(attain~sex,random=~primary+second,data=ScotsSec,verbose=F)
> summary(m2)

 Iterations = 3001:12991
 Thinning interval  = 10
 Sample size  = 1000

 DIC: 17024.80

 G-structure:  ~primary

        post.mean l-95% CI u-95% CI eff.samp
primary     1.127   0.7807    1.546      861

               ~second

       post.mean l-95% CI u-95% CI eff.samp
second     0.413   0.0656    0.819     1120

 R-structure:  ~units

      post.mean l-95% CI u-95% CI eff.samp
units     8.068    7.684    8.438     1000

 Location effects: attain ~ sex

            post.mean l-95% CI u-95% CI eff.samp  pMCMC
(Intercept)    5.2624   4.8660   5.5924     1000 <0.001 ***
sexF           0.4961   0.3095   0.6762     1139 <0.001 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Regards,

On 13 December 2010 11:03, Jeremy Koster <helixed2 at yahoo.com> wrote:
> Per a suggestion from David Atkins, I am trying to familiarize myself with the MCMCglmm package for the estimation of cross-classified mixed-effects models of inter-household food sharing.  I'm having a little trouble as I attempt to specify the model, however.
>
> I am wondering if anyone knows of resources for folks who are working with MCMCglmm after already being familiar with lme4.  In other words, are there any online scripts or other resources from researchers who have first estimated models in lme4, then specified comparable models in MCMCglmm?
>
> Thanks!
>
>
>
>
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>



-- 
Wincent Ronggui HUANG (Ph.D.)
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html




More information about the R-sig-mixed-models mailing list