[R-sig-ME] Is it possible to compute pairwise differences of LS-mean for all factors in a Generalized linear mixed model.

Guillaume Adeux gu|||@ume@|mon@@2 @end|ng |rom gm@||@com
Thu Jun 20 19:05:13 CEST 2019


Hi Julian,

You should look into the {emmeans} package and the function emmeans. The
vignettes are very nice, the package has a lot of features and from what I
can remember, glmmTMB is handled. Maybe time should be treated as
continuous and you should test slopes between CAP (with the emtrends()
function)?

Nevertheless, you could try different contrasts like:
emmeans(fit_zipoisson2, CAP|time)
or
emmeans(fit_zipoisson2, time|CAP)
or
emmeans(fit_zipoisson2, time*CAP)

You could the wrap the call with cld() from the {multcomp} package to
obtain a compact letter display.

Cheers,

GA2



<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Le jeu. 20 juin 2019 à 17:55, Julian Gaviria Lopez <
Julian.GaviriaLopez using unige.ch> a écrit :

> Hi everyone,
>
>
> I am fitting the next model with the glmm TMB package:
>
> > fit_zipoisson2 <- glmmTMB(Observations ~ CAP * Time + (1|ID), data=mDATA,
>
> ziformula=~ 1 , family=poisson)
>
> and I obtain as output the next one:
>
>
> > summary(fit_zipoisson2)
>
>  Family: poisson  ( log )
>
> Formula:          Observations ~ CAP * Time + (1 | ID)
>
> Zero inflation:                ~1
>
> Data: mDATA
>
>
>
>      AIC      BIC   logLik deviance df.resid
>
>   1252.8   1339.5   -604.4   1208.8      358
>
>
>
> Random effects:
>
>
>
> Conditional model:
>
>  Groups Name        Variance Std.Dev.
>
>  ID     (Intercept) 0.03325  0.1824
>
> Number of obs: 380, groups:  ID, 19
>
>
>
> Conditional model:
>
>                 Estimate Std. Error z value Pr(>|z|)
>
> (Intercept)      1.29264    0.14364   8.999   <2e-16 ***
>
> CAPinsC5        -0.70525    0.29149  -2.419   0.0155 *
>
> CAPpreC1        -0.21058    0.21474  -0.981   0.3268
>
> CAPpreC3        -0.14764    0.24991  -0.591   0.5547
>
> Timem1          -0.06505    0.22609  -0.288   0.7736
>
> Timem3          -0.11959    0.21359  -0.560   0.5755
>
> Timem4          -0.37762    0.21934  -1.722   0.0851 .
>
> Timem5          -0.31970    0.22905  -1.396   0.1628
>
> CAPinsC5:Timem1  0.19259    0.47302   0.407   0.6839
>
> CAPpreC1:Timem1 -0.73915    0.49687  -1.488   0.1368
>
> CAPpreC3:Timem1 -1.02677    0.54285  -1.891   0.0586 .
>
> CAPinsC5:Timem3  0.11425    0.43376   0.263   0.7923
>
> CAPpreC1:Timem3 -0.42517    0.35701  -1.191   0.2337
>
> CAPpreC3:Timem3 -0.14454    0.42445  -0.341   0.7335
>
> CAPinsC5:Timem4  0.76611    0.39757   1.927   0.0440 *
>
> CAPpreC1:Timem4  0.26068    0.32745   0.796   0.4260
>
> CAPpreC3:Timem4 -0.06192    0.41907  -0.148   0.8825
>
> CAPinsC5:Timem5  0.30779    0.50160   0.614   0.5395
>
> CAPpreC1:Timem5  0.42848    0.37898   1.131   0.2582
>
> CAPpreC3:Timem5  0.37346    0.35116   1.063   0.2876
>
>
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
>
>
> Zero-inflation model:
>
>             Estimate Std. Error z value Pr(>|z|)
>
> (Intercept)  -0.2467     0.1282  -1.924   0.0543 .
>
> ---
>
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> How can I observe the changes of the same CAP across time? Regardless if
> it is the intercept or not? E.g.:
> preC5 m1 vs preC5 m2
> preC5 m1 vs preC5 m3
> preC5 m1 vs preC5 m4
> preC5 m1 vs preC5 m4
>
> preC1 m1 vs preC1 m2
> … etc.
>
> And how can I observe the changes
> of the CAPs in relation to the predictor CAP (preC5) over time? E.g.:
> preC1 m1 vs preC5 m1
> preC1 m1 vs preC5 m2
> preC1 m1 vs preC5 m3
> preC1 m1 vs preC5 m4
> preC1 m1 vs preC5 m5
>
> I look for something similar to the Least-Square means and pairwise
> differences functions implemented in other packages for mixed models, such
> as
> the lmerTest:
> https://cran.r-project.org/web/packages/lmerTest/lmerTest.pdf
>
>
>  Thanks a lot in advance
>
> Julian Gaviria
> Neurology and Imaging of cognition lab (Labnic)
> University of Geneva. Campus Biotech.
> 9 Chemin des Mines, 1202 Geneva, CH
> Tel: +41 22 379 0380
> Email: Julian.GaviriaLopez using unige.ch
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

	[[alternative HTML version deleted]]



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