[R-sig-ME] trouble getting data scale predictions from a binomial MCMCglmm model
j.hadfield at ed.ac.uk
Wed Mar 23 13:48:33 CET 2011
The default in the predict function is to obtain the expectation after
marginalising the random effects, hence you should be multiplying c2
by the sum of the variance components (if the random structure is a
simple grouping) if you want to obtain the same answer. Alternatively,
you could specify marginal=NULL in the call to predict and this should
be the same as your preds.data.
See the posts for https://stat.ethz.ch/pipermail/r-sig-mixed-models/2011q1/005575.html
On 23 Mar 2011, at 12:19, Kari Ruohonen wrote:
> I have fitted a binomial model (logit link) with MCMCglmm by fixing
> unit variance to 1 as discussed in the CourseNotes of MCMCglmm.
> Now, I would like to get predictions on the data scale. I know there
> a predict function that does this but I need to be able to predict
> outside R. With the usual X%*%b where X is the model matrix and b the
> vector of coefficients I get predictions on the link scale. The
> predictions I get match those from the predict.MCMCglmm method with
> type="terms" option. However, I cannot figure out how to get the
> predictions on the data scale. CourseNotes discuss and give an example
> of scaling the coefficients suitably with c2 <- (16*sqrt(3)/(15*pi))^2
> and then dividing with (sqrt(1+c2*residual var)) to obtain estimates
> under residual variance =0 but I cannot figure out how to apply this
> the case of predictions.
> Here is a small example based on one in the CourseNotes:
> # the next predictions correspond to those from predict.MCMCglmm
> with "
> # type="terms"
> # but these do not correspond those with type="response"
> I am obviously missing something and would be grateful to someone
> helping me out.
> Many thanks, Kari
> R-sig-mixed-models at r-project.org mailing list
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the R-sig-mixed-models