[R-sig-ME] Extracting specific samples from MCMCglmm

Jarrod Hadfield j.hadfield at ed.ac.uk
Fri Feb 4 23:09:05 CET 2011


Hi,

If you specify pr=TRUE in the call to MCMCglmm the posterior  
distribution of random effects will be stored. They are in m$Sol in  
columns after the fixed effects.  You can obtain your predictions "by  
hand" by extracting the relevant random effects. Alternatively you can  
use the predict function, but currently this will only predict the  
data points used in model fitting.  In your case you want to use the  
random effects in the prediction rather than marginalising them so  
specify marginal=NULL in the call to predict. To obtain prediction  
intervals instead of confidence intervals specify  
interval="prediction" in the call to predict. This obtains prediction  
intervals using posterior predictie simulation so can be slow.

Cheers,

Jarrod




Quoting Ben Bolker <bbolker at gmail.com>:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>   I believe that if m is a an MCMCglmm fit, m$Liab will get you the
> "Posterior distribution of latent variables" (see ?MCMCglmm); I'm not
> sure whether there is useful information about the structure encoded in
> the object, but see if colnames(m$Liab) gets you something helpful.
>
>   Ben Bolker
>
>
> On 02/04/2011 02:50 PM, Robin Jeffries wrote:
>> Or alternatively, can I get the samples of the individual random effects out
>> of MCMC glmm?
>>
>>
>
>
>>
>>
>> On Fri, Feb 4, 2011 at 11:01 AM, Robin Jeffries <rjeffries at ucla.edu> wrote:
>>
>>> Hello,
>>>
>>> I'm very new at using MCMCglmm, so my apologies if my question is
>>> rudimentary. I can't even create a sufficient toy example to assist my
>>> explanation of what I'm trying to achieve. I've been working in  
>>> lmer on this
>>> for a little while, but since my end result is prediction for specific
>>> levels of my random effects, L-serv consensus seems to be that I switch to
>>> MCMCglmm.
>>>
>>>
>>> I'm running prediction models on some gaussian (and separately binomial)
>>> outcome where I have random intercepts and slopes - within factors.
>>>
>>> random=~ us(1+slope1 + slope2):Factor1 + us(1+slope1):Factor 2 + Factor3
>>>
>>> The short question is how do I create prediction intervals for specific
>>> levels of Factors 1-3?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Robin Jeffries
>>> MS, DrPH Candidate
>>> Department of Biostatistics
>>> UCLA
>>> 530-624-0428
>>>
>>>
>>
>> 	[[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk1MWmMACgkQc5UpGjwzenMwQQCeKlhelTFBDkeilyB+hb7aJ+HV
> FTUAoI5BeDVfdcMW+UpkJhnGlC3hDc68
> =y+W5
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> 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