MCMCglmm multinomial model in R

前端 未结 1 1483
囚心锁ツ
囚心锁ツ 2021-02-09 08:21

I\'m trying to create a model using the MCMCglmm package in R.

The data are structured as follows, where dyad, focal, other are all random effects, predict

相关标签:
1条回答
  • 2021-02-09 09:18

    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).

    0 讨论(0)
提交回复
热议问题