I am trying to create a model using the MCMCglmm package in R.
The data is structured as follows: where dyad, focal, others are all random effects, prediction 1-2 are predictor variables, and answer 1-5 are result variables that record # observed behaviors of different subtypes:
dyad focal other r present village resp1 resp2 resp3 resp4 resp5 1 10101 14302 0.5 3 1 0 0 4 0 5 2 10405 11301 0.0 5 0 0 0 1 0 1 β¦
So, a model with one result (teaching) is as follows:
prior_overdisp_i <- list(R=list(V=diag(2),nu=0.08,fix=2), G=list(G1=list(V=1,nu=0.08), G2=list(V=1,nu=0.08), G3=list(V=1,nu=0.08), G4=list(V=1,nu=0.08))) m1 <- MCMCglmm(teaching ~ trait-1 + at.level(trait,1):r + at.level(trait,1):present, random= ~idh(at.level(trait,1)):focal + idh(at.level(trait,1)):other + idh(at.level(trait,1)):X + idh(at.level(trait,1)):village, rcov=~idh(trait):units, family = "zipoisson", prior=prior_overdisp_i, data = data, nitt = nitt.1, thin = 50, burnin = 15000, pr = TRUE, pl = TRUE, verbose = TRUE, DIC = TRUE)
The Hadfield Course Notes (Ch 5) provide an example of a multinomial model that uses only one result variable with three levels (sheepβs horns of 3 types). A similar reference can be found here: http://hlplab.wordpress.com/2009/05/07/multinomial-random-effects-models-in-r/ This is not entirely correct for what I am doing, but it contains useful background information .
Another link (Hadfield 2010) provides an example of MCMCglmm with multiple answers, which follows the same format but uses cbind () to predict the response vector, and not for a single result. The same model with multiple answers will look like this:
m1 <- MCMCglmm(cbind(resp1, resp2, resp3, resp4, resp5) ~ trait-1 + at.level(trait,1):r + at.level(trait,1):present, random= ~idh(at.level(trait,1)):focal + idh(at.level(trait,1)):other + idh(at.level(trait,1)):X + idh(at.level(trait,1)):village, rcov=~idh(trait):units, family = cbind("zipoisson","zipoisson","zipoisson","zipoisson","zipoisson"), prior=prior_overdisp_i, data = data, nitt = nitt.1, thin = 50, burnin = 15000, pr = TRUE, pl = TRUE, verbose = TRUE, DIC = TRUE)
I have two programming questions:
How to specify the previous model? I looked at the materials mentioned in this post, but just can't figure it out.
I run a similar version with only two response variables, but I get only one slope - where I thought there should be a different slope for each resp variable. Where am I mistaken, or did I misunderstand the model?