[R-sig-ME] names of interaction / consistency between ranef and fixef

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Fri Jun 14 12:34:17 CEST 2019


Can you please post this as an issue on the github repo?

On Fri, Jun 14, 2019, 8:08 PM Baud-Bovy Gabriel <baud-bovy.gabriel using hsr.it>
wrote:

> Dear all,
>
> I found that in some cases the name of the interaction for RE and FE are
> not
> consistent even if they are specified in a consistent manner. The issue
> appears
> to be a lack of consistency about when the interaction names are reordered
> alphabetically:
>
> d <- expand.grid(a=1:10, b=1:10, su=1:10)
> d$y <- with(d, rnorm(10)[su] + a*rnorm(10)[su] + b*rnorm(10)[su] +
> a*b*rnorm(10)[su])
> d$y <- d$y + rnorm(nrow(d))
>
> # no reordering
> x <- lmer(y ~ b*a + (b*a || su), d)
> names(fixef(x))     # b + a + b:a
> names(ranef(x)$su)  #  b + a + b:a
>
> # reordering only for REs
> x <- lmer(y ~ b*a + (a*b || su), d)
> names(fixef(x))     # b + a + b:a
> names(ranef(x)$su)  #  a + b + a:b  # <= ro
>
> # consistent alphabetical reordering
> x <- lmer(y ~ a + b + b:a + (a + b + b:a || su), d)
> names(fixef(x))     # a b a:b
> names(ranef(x)$su)  # a b a:b
>
> # reordering only for FEs
> x <- lmer(y ~ a +  b + b:a + (a + 0 | su) + (b + 0 | su) + (b:a + 0 |
> su), d)
> names(fixef(x) )   # b + a + a:b
> names(ranef(x)$su) # a + b + b:a
>
> # warning messageabout missing slope when interaction names are not
> consistent
> insight::get_variance(x)
>
> I found the issue when using performance::r2, which calls
> insight::get_variance(x) and checks
> for consistency between names of RE and FE.  I am not sure if it is a bug.
>
> Best,
>
> Gabriel
>
> --
> ---------------------------------------------------------------------
> Gabriel Baud-Bovy               tel.: (+39) 348 172 4045     (mobile)
> UHSR University                       (+39) 02 2643 3429 (laboratory)
> via Olgettina, 58                     (+39) 02 9175 1540  (secretary)
> 20132 Milan, Italy              email:       gabriel.baud-bovy using hsr.it
> ---------------------------------------------------------------------
>
> [5xmille]<
> http://www.5xmille.org/?utm_source=mail&utm_medium=web_link&utm_campaign=5xmille_2018
> >
>
> 5xmille. INSIEME POSSIAMO continuare a scoprire nuove cure.
> CODICE FISCALE 07636600962
>
>
> Rispetta l’ambiente: non stampare questa mail se non è necessario.
> Respect the environment: print this email only if necessary.
> _______________________________________________
> R-sig-mixed-models using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]



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