Skip to content
Back to formatted view

Raw Message

Message-ID: <6a690593-a93f-588f-588e-a9f481e523cb@hsr.it>
Date: 2019-06-14T10:08:30Z
From: Baud-Bovy Gabriel
Subject: names of interaction / consistency between ranef and fixef

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 at 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.