Skip to content

random intercept or nested random?

2 messages · Julia Chacon Labella, Thierry Onkelinx

#
Hello to everybody,

I have read that in some cases the same variable could be consider either a
random or a fixed effect at the same time. But do not have any example for
this. Could someone explain me when is this the case? When there is a
justification to considered a variable in fixed effect term of the model
and also in the random part? I am quite interested on that.

I am thinking in the next example:

Imagine we are interested in knowing if the exam marks of pupils depends on
their Sex. So, you choose two different schools to check for this, but
School 1 is only for boys and School 2 is only for girls. Within each
school you sample many classes.

So, we would have ExamMarks as response variable.

SchoolSex as explanatory variable (in this given example would be the same
School or Sex), with two levels SchoolBoys and SchoolGirls

Class as explanatory variable, with many levels (8 per school), coded as
Class1, Class 2....up to Class16.

The model would be (lme4):

lmer(exammarks ~ Schoolsex + (1|Class), data=data)

So, we treat class as a random factor.

Should we consider in this case, the random part of the model as a nested
random and specify  it as (1|Class|Schoolsex) ?

In that case the model would be:
lmer(ExamMarks ~ Schoolsex + (1|Class|Schoolsex), data=data)

Thank you very much,
Julia
1 day later
#
Dear Julia,

I wrote a blogpost on this: https://www.muscardinus.be/2017/08/fixed-and-random/

Best regards,

ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
AND FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
thierry.onkelinx at inbo.be
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be

///////////////////////////////////////////////////////////////////////////////////////////
To call in the statistician after the experiment is done may be no
more than asking him to perform a post-mortem examination: he may be
able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data. ~ John Tukey
///////////////////////////////////////////////////////////////////////////////////////////




2018-02-17 11:54 GMT+01:00 Julia Chacon Labella <juliachacon at gmail.com>: