[R-sig-ME] Extracting the posterior distribution for a random effect in MCMCglmm
Robert Long
longrob604 at gmail.com
Mon Aug 6 11:56:53 CEST 2012
Hello
I would like to extract the data for the posterior distribution for a
random effect in MCMCglmm. Using the example in the tutorial:
data(Traffic)
prior <- list(R = list(V = 1, nu = 0.002), G = list(G1 = list(V = 1,
nu = 0.002)))
m2a.7 <- MCMCglmm(y ~ year + limit + as.numeric(day), random = ~day,
family = "poisson", data = Traffic, prior = prior, verbose = FALSE, pr=T)
summary(m2a.7)
This gives:
G-structure: ~day
post.mean l-95% CI u-95% CI eff.samp
day 0.09326 0.06076 0.1313 266.8
How can I extract the data that gives this mean and 95% BCI ?
I can see that I can obtain the results for the fixed effects by such as:
mean(m2a.7$Sol[,1]) which gives the posterior mean for the first fixed
effect. But how can I do that for the random effects ? I can see that
there are data in m2a.7$Sol[,5:96] but these don't seem to be
variances as many are negative.
A related question is: quantile(m2a.7$Sol[,1],c(0.025,0.975),type = 1)
does not give precisely the same interval as in summary(m2a.7) - I
wonder why there is a difference ?
Thanks !
Robert Long
Postgraduate student
University of Leeds / UK
More information about the R-sig-mixed-models
mailing list