MCMCglmm multinomial model in R

你离开我真会死。 提交于 2019-12-03 08:10:41

Answer to my first question, based on the HLP post and some help from a colleage/stats consultant:

# values for prior
k <- 5 # originally: length(levels(dative$SemanticClass)), so k = # of outcomes for SemanticClass     aka categorical outcomes 
I <- diag(k-1) #should make matrix of 0's with diagonal of 1's, dimensions k-1 rows and k-1 columns
J <- matrix(rep(1, (k-1)^2), c(k-1, k-1)) # should make k-1 x k-1 matrix of 1's 

And for my model, using the multinomial5 family and 5 outcome variables, the prior is:

prior = list(
             R = list(fix=1, V=0.5 * (I + J), n = 4),
             G = list(
               G1 = list(V = diag(4), n = 4))

For my second question, I need to add an interaction term to the fixed effects in this model:

 m <- MCMCglmm(cbind(Resp1, Resp2...) ~ -1 + trait*predictorvariable,
 ...

The result gives both main effects for the Response variables and posterior estimates for the Response/Predictor interaction (the effect of the predictor variable on each response variable).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!