[R-sig-ME] Predicting values from MCMCglmm model with statistical weight in mev argument
Kamal Atmeh
k@m@|@@tmeh @end|ng |rom hotm@||@com
Sat Feb 15 23:57:08 CET 2020
Dear list,
I'm quite new to MCMCglmm and after reading much of Jarrod Hadfield's
documentation I was able to understand the basic construction and
interpretation of models. However, I am having a bit of trouble when
predicting values from my gaussian MCMC model. I am running bayesian
phylogenetic mixed models to determine factors responsible for the
variation of my movement parameter. My response variable is continuous
and each point has a standard error associated to it and which I added
as a statistical weight in the model using the mev argument in the
MCMCglmm function. I have 5 random effects: phylogeny (to which I
attributed the species covariance matrix using the ginverse argument),
species, population, year and individual. My model is thus as follows:
>>> model <- MCMCglmm(lD ~
tactic*period*seasonality+complique_KF+lbody+lintdur+lnb.loc+lduration
, random =
~sp_phylo+species2+phylo_pop+phylo_popY+phylo_pop_id
, family = "gaussian"
, mev = SE^2 # error variance
associated to each data point
, ginverse = list(sp_phylo =
inv.phylo$Ainv) # include a custom matrix for argument phylo
, prior = prior1
, data = Data
, nitt = 22e+04
, burnin = 20000
, thin = 100
, pr=TRUE)
When I try to predict values from the model above, I obtain the
following error:
>>> pred_DGLOB <- predict.MCMCglmm(model_D_GLOB_ch1
, type = "response"
, interval = "confidence"
, newdata = newdt)
>>> Error in rep(as.numeric(rcomponents %in% mcomponents),
object$Random$nrt) :
invalid 'times' argument
It appears that this error is originating from the following specific
code in the predict.MCMCglmm function:
>>> marginalise<-rep(as.numeric(rcomponents%in%mcomponents),
object$Random$nrt)
It appears that object$Random$nrt has one additional element compared to
as.numeric(rcomponents%in%mcomponents).
I already ran predict.MCMCglmm with models without any statistical
weight and the predict.MCMCglmm function worked fine. Is this a problem
caused by the fact that I have the standard error in the mev argument?
If yes, is there a way to go around it? I may be skipping some steps
before running the predict function but I did not find any documentation
that addresses this issue.
I would greatly appreciate your help and happy to provide further
information if needed!
Thank you in advance!
Kamal
More information about the R-sig-mixed-models
mailing list