[R-sig-ME] MCMCglmm interaction and posterior mode

Kamal Atmeh k@m@|@@tmeh @end|ng |rom hotm@||@com
Thu Mar 4 16:26:15 CET 2021


Hello Walid,

Thank you for your prompt response!

The at.level() function works perfectly and does exactly what I want. I 
have also modified the other 2-way interactions to only include the 
level of interest (H).

As for the broom package, even broom. mixed, it seems that it mostly 
gives a tidy version of the model's output. I haven't found a function 
that does the automatic computation though, but I will look more thoroughly.

Thanks again!

Cheers,

Kamal

Le 03/03/2021 à 23:17, Walid Crampton-Mawass a écrit :
> Hello Kamal,
>
> One way to do this with MCMCglmm is to use the at.level() function. 
> You can determine for which level of your categorical variable you 
> want the interaction, ex. at.level(tactic,2):a.level(period,2):env.
>
> However, in doing so you are only estimating the coefficient for that 
> specific interaction and ignoring the rest. That to me would seem a 
> bit odd given that for the 2-way interactions you are still including 
> the other levels, but of course it depends on what assumptions you are 
> making for your model.
>
> and regarding automating the computation of the posterior mean, I 
> think (not sure though) that the broom package offers some wrap 
> functions for MCMCglmm and computing posterior estimates.
>
> Good luck
> -- 
> Walid Crampton-Mawass
> Ph.D. candidate in Evolutionary 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
>
>
> On Wed, Mar 3, 2021 at 4:19 PM Kamal Atmeh <kamal.atmeh using hotmail.com 
> <mailto:kamal.atmeh using hotmail.com>> wrote:
>
>     Dear all,
>
>     I have some questions, which may sound trivial, pertaining to
>     interaction models with MCMCglmm.
>
>     I am running the following model with a gaussian distribution and a
>     3-way interaction between two categorical two-level variables
>     (tactic:
>     F/H and period PB/B) and one continuous variable (env):
>
>     model <- MCMCglmm(lD ~ tactic*period*env
>                                           , random =
>     ~sp_phylo+species2+phylo_pop+phylo_popY+phylo_pop_id
>                                           , family = "gaussian"
>                                           , 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)
>
>     After looking at the results, I found that the 2-way interaction
>     tactic*env from the tactic*period*env interaction was not
>     significant,
>     however the 3-way interaction itself was, with the following
>     output in
>     the summary:
>
>      >>>   tacticH:periodB:env      0.17831  0.05360 0.30512     5000
>     0.0052 ** (the intercept represents tactic F and period PB)
>
>     I tried to run the model again in order to simplify it using ":" and
>     therefore remove the non-significant 2-way interaction:
>
>     model2 <- MCMCglmm(lD ~ tactic*period + period*env +
>     *tactic:period:env*
>                                           , random =
>     ~sp_phylo+species2+phylo_pop+phylo_popY+phylo_pop_id
>                                           , family = "gaussian"
>                                           , 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 using ":", the output of my model returns the posterior mean for
>     each level of the categorical variables instead of one level as
>     before:
>
>     tacticF:periodPB:env -0.1668620 -0.3554264  0.0005143    195.0
>     0.0923 .
>     tacticF:periodB:env  -0.2018706 -0.3783204 -0.0174366    195.0
>     0.0410 *
>     tacticH:periodPB:env -0.1561097 -0.2066183 -0.1093840    118.2
>     <0.005 **
>
>     How should I define the interaction in the model in order to
>     obtain an
>     output similar to the one when the "*" interaction was used
>     (tacticH:periodB:env) while simplifying and removing the
>     non-significant
>     interaction from the 3-way interaction?
>
>     Finally, is there a way to automatically compute the posterior
>     mean of
>     the continuous variable for each modality of the interaction?
>
>     Thank you and stay safe!
>
>     Kamal
>
>
>             [[alternative HTML version deleted]]
>
>     _______________________________________________
>     R-sig-mixed-models using r-project.org
>     <mailto:R-sig-mixed-models using r-project.org> mailing list
>     https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>     <https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models>
>

	[[alternative HTML version deleted]]



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