[R-sig-ME] predictions for MCMCglmm

Jarrod Hadfield j.hadfield at ed.ac.uk
Tue Mar 19 10:27:26 CET 2013


Hi Antonio,

With (simple) random effects marginalised:

X<-model.matrix(~ maternal_age_c + I(maternal_age_c^2)  +  
as.factor(birth_year) + residence + sex + wealth, data=newdata)

V<-rowSums(glm.MC.2$VCV)

beta<-glm.MC.2$Sol

c2 <- (16 * sqrt(3)/(15 * pi))^2

pred<-t(plogis(t(beta%*%t(X)/sqrt(1+c2*V))))

pred[i,j] is the prediction for the jth new data point for the ith  
MCMC sample. colSums(pred)  should be equivalent to the output from  
predict.MCMCglmm.

Cheers,

Jarrod



Quoting "Antonio P. Ramos" <ramos.grad.student at gmail.com> on Mon, 18  
Mar 2013 20:04:07 -0700:

> Hi all.
>
> As far as I can tell newdata is still not implemented for this nice
> package. Thus I wonder what would be the best way to get predictions "by
> hand". My model is actually very simple. Still I need to marginalize the
> random effects. Any hints? Thanks in advance, Antonio Pedro.
>
>
> glm.MC.2 <- MCMCglmm(mortality.under.2 ~ maternal_age_c +
> I(maternal_age_c^2)  +
>                        as.factor(birth_year) + residence +
>                        sex + wealth,
>                      nitt=20000, thin=10, burnin=1000,
>                      random= ~CASEID, prior=prior.2,data=egypt2,
> family='categorical')
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>



-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



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