[R-sig-ME] MCMCglmm error

HADFIELD Jarrod j@h@d||e|d @end|ng |rom ed@@c@uk
Wed Mar 20 20:34:46 CET 2019


MCMCglmm used to issue a warning if there were NA’s in the random effect predictors. However, people seemed to ignore it when it was inappropriate. The only case I can think of where it should be ignored is in a multi membership model where the number of members varies over observations, which is probably a rare type of model. Consequently, I now just stop people doing what I *think*they didn’t intend. It may be the case that you don’t know who the mother is, but that doesn’t mean they don’t have a mother. Fitting a dummy maternal id is the standard solution.

A more informative error message will be in the next release.



> On 20 Mar 2019, at 19:01, Walid Crampton-Mawass <walidmawass10 using gmail.com> wrote:
> Hello everyone,
> I started getting this error when I run an animal model with a maternal
> random effect using MCMCglmm. here is my code:
> *prior1 <- list(R=list(V=1, nu=0.002), G=list(G1=list(V=1,
> nu=0.002),G2=list(V=1, nu=0.002)))*
> *model_afr_3_1 <- MCMCglmm(AFR~
> 1+OffMortality+COEFPAR+I(COEFPAR*COEFPAR)+TWIN+BIRTHYW+mortrate1 , random =
> ~animal + MOTHERW, rcov = ~units, data = IAC, pedigree = prunedPed, family
> = "gaussian" , nitt = 3500000, burnin = 500000, thin = 3000, prior =
> prior1, verbose = FALSE, pr=TRUE)*
> *Error in t(ZZ[[k]]) : invalid object passed to as_cholmod_sparse*
> *Calls: MCMCglmm -> buildZ -> t -> t*
> I was able to find out that the variable causing the error is the second
> random term "MOTHERW" which represents the id of each individual's mother
> as to model maternal variation. However I started getting this error
> recently even though it used to work beforehand without any errors. The
> variable is set as a multi-level factor just as is done to the "animal"
> variable. But there are a few missing values for some individuals (20 out
> of 572)
> *str(dat$MOTHERW)*
> * Factor w/ 297 levels "100007","100032",..: 114 142 207 12 258 168 261 230
> 179 107 ...*
> I tried another variable, FATHERW, which is the id of the father of the
> individual. I get the same error again : *Error in t(ZZ[[k]]) : invalid
> object passed to as_cholmod_sparse*
> However, when using another variable in my data as a random variable
> instead, BIRTHYW (birth year of individual; set as a factor), the model
> runs without any errors. The only difference is that there are no missing
> values in this variable compared MOTHERW  and FATHERW.
> is it probably the case that we can't use a variable with a few missing
> values as a random variable in MCMCglmm anymore?
> Thanks for any help!
> --
> Walid Mawass
> Ph.D. candidate in Cellular and Molecular Biology
> Population Genetics Laboratory
> University of Québec at Trois-Rivières
> 3351, boul. des Forges, C.P. 500
> Trois-Rivières (Québec) G9A 5H7
> Telephone: 819-376-5011 poste 3384
> [[alternative HTML version deleted]]
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.

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