[R-sig-ME] Multivariate multinomial in MCMCglmm
Jarrod Hadfield
j.hadfield at ed.ac.uk
Wed Aug 13 19:20:59 CEST 2014
Hi Szymek,
cbind(response1, response2)~trait ...
If we use the notation A.B to denote log odds ratios for category A in
response B, then the traits in order are 2.1, 3.1, 2.2, 3.2, 4.2. You
can use things like at.level(trait, 1:2) and at.level(trait, 3:5) if
you only want to fit effects for one of the responses.
Note that the prior G1=list(V=IJ, nu=K-1+0.002)) is likely to have a
large effect.
Cheers,
Jarrod
Quoting Szymek Drobniak <szymonmarian.drobniak at uzh.ch> on Wed, 13 Aug
2014 18:03:15 +0200:
> 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]]
>
> _______________________________________________
> 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