[R-sig-ME] HPDinterval MCMCglmm and using transformed variables in MCMCglmm

Jarrod Hadfield j.hadfield at ed.ac.uk
Mon Jul 12 12:30:33 CEST 2010

Dear Rebecca,

You probably need to load MCMCglmm (library(MCMCglmm)) or at least  
load coda. At the moment the response needs to be logged externally:


but the next version will "fix" this.



On 12 Jul 2010, at 10:31, Rebecca Ross wrote:

> Dear ME users,
> Apologies if this is a naive question, I am new to using MCMC glmm.  
> I have been working through the tutorial, using some of my own data,  
> and I thought I had followed the steps correctly. The model I have  
> been fitting is:
> AMstem3<-MCMCglmm(log(stem)~Dist_fr_A,random=~Block 
> +animal,pedigree=Ped,data=SapRO,prior=prior1.3,
> family="gaussian")
> Briefly, I want to see how the Distance variable (continuous)  
> affects stem weight, which I have log transformed as the raw data is  
> heteroscedastic. Block is field block, and I am fitting the animal  
> random effect to take into account different relatedness between  
> individuals (I'm not at the moment trying to estimate Va).
> When I tried this model last night, I could get the 95% CIs using  
> this function
> HPDinterval(AMstem3$Sol[,"Dist_fr_A"])
> HPDinterval(AMstem3$VCV)
> When I tried this morning, I get the following error message
> Error in function (classes, fdef, mtable)  :
>  unable to find an inherited method for function "HPDinterval", for  
> signature "mcmc"
> Can anyone explain what  has gone wrong? I've tried changing the  
> terms in the model, but that doesn't help, so I think I must have  
> changed something in R elsewhere? Or else missing something  
> completely obvious.
> Question 2: I dont think MCMCglmm is actually logging my stem  
> variable because the fixed effect parameter estimate from the model  
> above (AMstem3) are about a factor of 10 out from the fixed effect  
> estimate from
> a similar model, fit in lme4, without the animal effect and very  
> similar to the same model using the raw stem weight (see below). Do  
> I need to specify the log transform differently?
> AMstem3c Dist_fr_A  posterior mode: -0.004236659
> versus:
> stem5a<-lme(log(stem)~Dist_fr_A,random=~1| 
> Block,data=SapRO,na.action=na.omit)
> Fixed effect Estimate: Dist_fr_A   -0.0004442 (SE=0.00006136)
> and:
> stem5b<-lme(stem~Dist_fr_A,random=~1| 
> Block,data=SapRO,na.action=na.omit)
> Fixed effect Estimate: Dist_fr_A   -0.004342 (SE=0.0006714)
> Thank you very much for your help,
> Rebecca Ross
> DPhil Candidate,
> University of Oxford.
> 	[[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