I am wanting to use a multimembership MCMCglmm with the following model

nsamp <- 2000
THIN <- 100
BURNIN <- 3000

mcModela <- MCMCglmm(cbind(count.tog,count.apart) ~ Sexpair + 
              Sexpair:(scale(TrioML.R)), random = ~ mm(ID1 + ID2), 
              nitt = NITT, thin = THIN, burnin = BURNIN, 
              family = "multinomial2", data = assort_b, 
              verbose = FALSE)

Sexpair has the following levels M_M, M_F and F_F. TrioML.R is a continuous covariate that I have mean centred. ID1 and ID2 indicate the individual identities for each dyadic observation. I haven't specified any priors so that all info comes from the data. This produces the following output

sols <- summary(mcModela)$solutions 
                             post.mean    l-95% CI   u-95% CI
(Intercept)                 -2.8694404   -4.660506 -0.8248128
SexpairF_F                   0.9684242   -1.349167  3.2829986
SexpairM_M                 -32.5909713  -73.597824 -3.0423063
SexpairM_F:scale(TrioML.R)  -1.1555533   -2.659659  0.1135262
SexpairF_F:scale(TrioML.R)   0.4839637   -1.309041  2.9091455
SexpairM_M:scale(TrioML.R) -72.5303991 -167.074322  1.0027751
                              eff.samp  pMCMC
(Intercept)                1786.489094 0.0140
SexpairF_F                 2121.444933 0.3650
SexpairM_M                    9.047826 0.0005
SexpairM_F:scale(TrioML.R) 1553.295932 0.0450
SexpairF_F:scale(TrioML.R)  861.841779 0.7020
SexpairM_M:scale(TrioML.R)    9.691509 0.0050

I am aware that an effective sample of 100-1000 is ideal. As you can see for some covariates the effective sample size is much larger or close to 1000, while for other covariates it is quite low. I have tried adjusting the NITT, THIN, and BURNIN but the results are very similar (some covariates have a high eff. samp while others have a very low eff. samp).

For 'SexpairM_M' and 'SexpairM_M:scale(TrioML.R)' there's very poor mixing of the chain:

chainmixing1 chainmixing2

However, for all other covariates this seems to be ok. I think this might be because there is a lot of zeros for one of the response variables ('count.tog') for SexpairM_M - could this cause poor mixing of the chains?

and I get the following for autocorrelation of the chains

         ID1+ID2.    units
Lag 0    1.0000000   1.0000000
Lag 100  0.22808372  0.4594582
Lag 500  0.14334204  0.2974043
Lag 1000 0.09248625  0.2163000
Lag 5000 -0.01672504 0.0178789

My questions are:

(1) Is it essential to specify priors for this type of model, and, if so, how would I go about specifying priors for this type of model?

(2) Will refitting the model with priors specified increase the effective sample size for the covariates with a small effective sample?

(3) Should I be concerned about the interpretation of this model with some covariates with a low effective sample?

If I fit the model with just the interaction term and a second model without the interaction term I seem to get a better result with the 'SexpairM_M' and 'SexpairM_M:scale(TrioML.R)' having a higher effective sample and better mixing of the chain. Therefore, my last question is

(4) Would it be better to fit multiple models to increase the effective sample/mixing of the chain?

I haven't been able to find much help online with the multimembership type MCMCglmm and I am new to Bayesian analysis so any help would be greatly appreciated!


1 Answer 1


I am also in the process of wrestling with MCMCglmm, so while I am no authority on the subject I will try to provide some answers. Though note that I know nothing of multimembership analysis, so my answers will be general:

  1. I would say yes, because by not including a prior it is not that you are not using a prior. Rather you are using an improper prior, which is usually undesirable. As the author of the package states in the course notes:

"When improper priors are used there are two potential problems that may be encountered. The first is that if the data do not contain enough information the posterior distribution itself may be improper, and any results obtained from MCMCglmm will be meaningless. In addition, with proper priors there is a zero probability of a variance component being exactly zero but this is not necessarily the case with improper priors. This can produce numerical problems (trying to divide through by zero) and can also result in a reducible chain." - Jarrod Hadfield

How to go about defining your prior can also be learned from the Course notes, as well as from the links I placed below.

  1. According to the Course notes, using certain priors can increase your effective sample size. And the (effective) sample size is also determined by your initial values of nitt, burnin and thin. However, the lack of your effective sample size may also have to do with a lack of convergence (which can also be helped by using better priors, or increasing the run-length of your model).

  2. Yes I would be, but what I find more concerning is that your model does not seem to have converged. The trace plots you made should display a 'fuzzy caterpillar'. I know such a description is vague, so I will link to some tutorials which I found immensely valuable in using MCMCglmm. But in short: When running an MCMCglmm it is vital that your model converges. You can verify whether a model converges by:

  • Looking at the trace plots (Do you see a fuzzy caterpillar)
  • Looking at autocorrelation (FYI your autocorrelation also seems very high, Jarrod Hadfield in the Course Notes suggests that an autocorrelation of <0.1 is desirable)
  • Looking at Geweke diagnostics/plots
  • Look at gelman diagnostics/plots
  • Visually inspect multiple runs and whether they converge on the same point
  • Comparing the model outcome using different priors (Less for convergence and more to find out how sensitive your model is to prior specification).
  1. No, I would fit multiple models to diagnose if the parameters you use for your initial model are indeed in order and if your model is converging (as demonstrated in link number 4 below).

In short, I would first try to define a prior and get the model to converge. To do so, I strongly advise you read the course notes. I will here link to some tutorials & papers I found immensely helpful:

  1. The Course Notes by Jarrod Hadfield. The go-to for any questions related to the package.
  2. The paper An ecologist’s guide to the animal model. Be sure to also check out their supplementaries, but as they mention themselves in an erratum, be wary of just copying what they did and try to understand what applies to your situation.
  3. An introduction to the MCMCglmm package. Gives both a clear practical and theoretical understanding of the MCMCglmm package.
  4. Using MCMCglmm to implement lme4-like Bayesian mixed-effects models (DRAFT). While this is a draft, and the author considers the tutorial obsolete due to the rise of the "brms" package, I still found it incredibly useful.
  5. Worksheet 10 - Generalized Linear Mixed effects Models (GLMM's). Useful particularly for understanding concepts and diagnostics.
  6. Finally How to fit an animal model. While in theory this tutorial is for understanding how to fit an animal model, it helped me understand how to work through an example model.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.