[R-sig-ME] fitting a MCMCglmm zero-inflated model
dani
orchidn at live.com
Mon Oct 23 10:55:39 CEST 2017
Hello Jarrod,
Thank you so much for your prompt response. Yes, that sounds right, I will make the correction. Interestingly, after I posted my message, I restarted R and the model magically worked. SInce I used implicit specifications (13000 iterations), my effective samples were ridiculous; for example:
R-structure: ~idh(trait):units
#
# post.mean l-95% CI u-95% CI eff.samp
# traity.units 0.1155 0.07864 0.1696 7.503
# traitzi_y.units 1.0000 1.00000 1.0000 0.000
Thank you so much and have a nice day everyone!
Best, DNM
________________________________
From: Jarrod Hadfield <j.hadfield at ed.ac.uk>
Sent: Monday, October 23, 2017 1:50 AM
To: dani; r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] fitting a MCglmm zero-inflated model
Hi,
You've missed a comma after the random argument.
At the moment you are fitting a single effect of x4, x5,x6 and x7 for
both the zi and the Possion processes. Presumably you only intend to fit
effects for these terms for the Poisson part? I would use the formula:
y ~ trait - 1 + at.level(trait,1):(offset+x1+x2+x3+x4+x5+x6+x7)
Your priors are strong too - I would use nu=0.002 rather than nu=2.
Cheers,
Jarrod
On 23/10/2017 09:28, dani wrote:
> Dear list members,
>
>
> I need some advice regarding fitting a MCMCglmm zero-inflated model.
>
>
> I fitted a zero-inflated Poisson model with a single zero inflation parameter for all observations (ziformula~1) in glmmTMB. I would now like to run a similar model based on MCMCglmm.<http://aka.ms/weboutlook>
>
> I must confess I am not sure I understood how to use the at.level term to model interactions with covariates at level 1 in my model. It is not clear to me how to specify the prior.
>
> My model has an offset term and two cross-classified random groups, as well as the following variables:
> - Level 1 variables: x1, x2, and x3
> - Level 2 (group 1) variable: x4
> - Level 2 (group 2) variables: x5, x6, and x7
>
> Here is the code:
>
> priori <- list(R=list(V=diag(2), n=2,fix=2),
> G=list(G1=list(V=diag(2), n=2),G2=list(V=diag(2), n=2)))
>
> model <- MCMCglmm(y ~ trait - 1 + at.level(trait,1):offset +
> at.level(trait,1):x1 +
> at.level(trait,1):x2 +
> at.level(trait,1):x3 +
> x4+ x5 + x6+x7 ,
> random = ~idh(trait):group1 + idh(trait):group2
> family = "zipoisson",
> prior = priori,
> rcov = ~idh(trait):units,
> data = mydata)
>
> I am getting the following message:
> Error in cbind_all(x) : Argument 2 must have names
>
> As I am pretty sure that my prior and my at.level terms specification are all kinds of wrong:) , I am not worried at this point about the error message, but I would like to ask advice as to how to properly specify this model.
>
> Thank you all for your constant help, this list is amazing!
> Best regards, everyone,
> Dani NM
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
R-sig-mixed-models Info Page - stat.ethz.ch<https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
stat.ethz.ch
Your email address: Your name (optional): You may enter a privacy password below. This provides only mild security, but should prevent others from messing ...
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list