[R-sig-ME] Factor level contrasts and associated fixed effect priors in MCMCglmm

Mohammed Armani moarmani at outlook.com
Sat Apr 7 08:02:44 CEST 2018

Deal all,
I am running a phylogenetic binary model in the package MCMCglmm (The response variable being Resp (0, 1)). One of my predictors is a categorical variable (with 3 levels: T1, T2 and T3) and I would like to set-up the model to explicitly test for differences between the levels of this factor (i.e. T1 vs T2; T1 vs T3 and T2 vs T3). I am following the GLMM worked example of https://ms.mcmaster.ca/~bolker/R/misc/foxchapter/bolker_chap.html and proceeded as follows:

               byrow=TRUE, ncol=3,
               dimnames=list(c("T1 vs T2",
                               " T1 vs T3 ",
                               " T2 vs T3"),



datar <- with(data,data.frame(Resp,T,phylo,
mod_1<-MCMCglmm(Resp~ T1 vs T2+ T1 vs T3 + T2 vs T3-1,random=~phylo,family="categorical",


1.       First, I would be grateful to receive some feedback if I am doing the right thing with setting the contrasts!

2.       Secondly, one of the factor levels (T2) has only success in the response variable (all=1). I understand from the MCMCglmm course note that in such instances a fixed effect prior such as B=list (mu=c (0, 3), V=diag (3)*(1+pi^2/3) can be applied. However, in the instance where an explicit contrasts is specified as I have done, I am unsure of how to specify the contrast for the fixed effect terms


Armani M

	[[alternative HTML version deleted]]

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