[R-sig-ME] MCMCglmm with missing values

Monica Anderson Berdal m@@nder@on@berd@| @end|ng |rom gm@||@com
Mon Mar 16 14:24:35 CET 2020

Sorry, here is a plain text version with CSV data.

I’m trying to run a MCMCglmm where two of the response variables and
three of the fixed effects are sex specific. Each line represents one
individual, and the data looks like this:












All individuals have a behaviour mass recorded, and only the sex
specific variables have NAs. I’ve been using the at.level function to
control for these missing values, but still get the error: Missing
values in the fixed predictors

cricketMCMC <- MCMCglmm(cbind(Fitness_F, Fitness_M, Behaviour, Mass)~

                          at.level(trait, 1):(Age_F + Mate_mass) +

                          at.level(trait, 2):(Age_M) +

                          at.level(trait, 3):(Sex + Temperature) +

                          at.level(trait, 4):(Sex + Temperature),


                        family=rep("gaussian",4), nitt=260000,
thin=200, burnin=60000,

                        verbose=FALSE, prior=prior.4t, pr=TRUE, data=Data)

To avoid the issues of missing values I added mean values for Age_F
and Mate_mass for the males and Age_M for the females, while still
using the at.level function. The idea was to overcome the problem with
the missing values while also ignoring the mean values for the sex
specific traits. This model ran without problems, and to see if the
model ran properly, I compared it to a second model where I added a
random value instead of mean values. I used set.seed() before running
both models, but the outputs are not the same, which means that the
added values are still affecting the results.

How can I avoid the problems of NAs when running an MCMCglmm on a data
set with this structure?

More information about the R-sig-mixed-models mailing list