0

I am trying to perform a MCMCglmm of the kind

df=data.frame(y=rep(c(0:2),each=12),x=rnorm(3*12))
MCMCglmm(data=df,fixed=y~x, family="categorical")

and I get the error message

For error structures involving catgeorical data with more than 2 categories pleasue use trait:units or variance.function(trait):units.

I had a quick look at Jarrod Hadfield's course notes but did not find much specification about this notation and its meaning.

What does the notations trait:units and variance.function(trait):units mean? How would one typically use them?

I welcome you to for example consider the command

 m <- MCMCglmm(LetVerb ~ -1 + trait + trait:(Channel + CrSem + MS),
random = ~us(trait):Vinf, rcov = ~ us(trait):units, data = letting,
family = "categorical", prior = priors, verbose = TRUE, burnin =
10000, nitt = 60000, thin = 50)

from the third page of this tutorial

Remi.b
  • 17,389
  • 28
  • 87
  • 168
  • 1
    Did you ever find a solution to your question? Having the same issue. – xv70 Feb 27 '17 at 23:05
  • 1
    I would not be able to elaborate an answer as much of MCMCglmm internal mechanism is still very obscure to me but I managed to fix my problem. I ended up with a prior like `prior <- list(R = list(V=diag(n-1),nu=0.02,fix = 1)) `, where `n` is the number of levels of the response variable. The run is then `MCMCglmm( data=myData, fixed= Response ~ trait:(expl1) + trait:(expl2), rcov=~us(trait):units, family="categorical",prior = prior)` – Remi.b Feb 27 '17 at 23:29

1 Answers1

0

For the notation question, see my answer to a related post here.

All the answers to your questions are actually in Jarrod Hadfield's course notes. You will need to read up on the specification of residual variances for multinomial models in Section 5. But briefly, the option rcov = ~ us(trait):units allows to model an unconstrained residual variance structure, i. e., the residual variances for different response categories can be thereby modeled heteroscedastically (with different variances for different categories) and non-spherically (allowing any pairwise category residual covariances to be non-zero).

marsarius
  • 11
  • 4