[R-sig-ME] Multivariate multinomial in MCMCglmm

Szymek Drobniak szymonmarian.drobniak at uzh.ch
Wed Aug 13 18:03:15 CEST 2014


Dear List Members,

I'm wondering if you have experience (if it's passible in the first place)
in fitting a mixed model with multiple multinomial responses in MCMCglmm. I
was trying to fit such model but I bumped into the truble of what the
"trait" dummy variable does actually index in such a model?

In a "univariate" multinomial model (which actually already is
multivariate) like the one below the trait variable indexes single odds
ratios for 2nd/3rd... category against the 1st category. Is it possible to
extend this into a situation with more than one multinomial variables?


cheers,
Szymek

require(MCMCglmm)

mydata <- data.frame(response1 = c(sample(c("a","b","c"), replace=T, size =
100)),
                     covariate = rnorm(100), random =
gl(20,5,labels=letters[1:20]))


K <- length(levels(mydata$response1))
I <- diag(K-1)
J <- matrix(0,K-1,K-1) + 1
IJ <- 1/K*(I+J)

size=2
prior <- list(R=list(V=IJ, fix=1),
              G=list(G1=list(V=IJ, nu=K-1+0.002)),
              B=list(mu=rep(0,size*(K-1)), V=kronecker(IJ,
diag(size))*(1.7+pi^2/3)))

model <- MCMCglmm(response1~trait*covariate-1, random=~us(trait):random,
rcov=~us(trait):units,
                  family="categorical", data=mydata, prior=prior)

#######################################

## now what to do with the 2nd response variable?

mydata$response2 <- as.factor(c(sample(c("w","x","y","z"), replace=T, size
= 100)))


-- 

*Dr Szymon Drobniak*
Anthropological Institute and Museum
Office Y42-K-66
University of Zürich - Irchel
Winterthurerstrasse 190
CH-8057 Zürich, Switzerland

	[[alternative HTML version deleted]]



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