1

In this post @Ben Bolker wrote in his answer that for the interaction between station and day we could write station+(1|day/station), but I don't understand how this is possible. In the OP, day is a random effect and station is fixed, but writing (1|day/station) means you are nesting station within day, in which case you are treating both station and day as random effects. My understanding is that nesting can only apply to random effects, according to @Tim's comment here.

Also in @John's answer he mentions in the end that we could create a model like

lmer(y ~ station + (tow*day|station), data = dat)

but isn't this specifying station as a random effect (ie right side of | and within parentheses)? Shouldn't it rather be lmer(y ~ station + (station|tow*day), data = dat)? Am I missing something?

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
locus
  • 743
  • 4
  • 17
  • (1|day/station) means (1|day) + (1|day:station), so it's a random effect of day and a random effect of day:station interaction. An interaction between random factor and a fixed factor is random. There is no random effect of station alone here (because station is random). So Ben's answer is correct. – amoeba Jul 04 '18 at 08:33
  • Regarding (day|station), I don't see how it makes sense if station is fixed. – amoeba Jul 04 '18 at 08:34
  • Thanks @amoeba. In the first comment you wrote "(because station is random)", but I think you meant "fixed", or am I wrong? – locus Jul 12 '18 at 23:52
  • Regarding the (1|day/station), I was confused because I thought the / symbol always meant nested random effects like in the (1|school/class) situation in which school and class are both random effects. But if I understand it correctly, the (1|A/B) syntax could also mean random effect of A plus random effect of A-B interaction. This is somewhat confusing, how does lmer distinguish between nested random effects and random-fixed interaction effect? – locus Jul 12 '18 at 23:54
  • (1) Yes, that's what I meant, sorry for confusion. (2) Yes, you are absolutely right, it can mean these two things. Lmer does not actually need to distinguish between them, because mathematically they are the same. I have once asked a similar question myself (https://stats.stackexchange.com/questions/232109) but I am not happy with any of the answers. I should post my own answer there when I have time. – amoeba Jul 13 '18 at 06:56
  • Thanks @amoeba. I look forward to your answer, I learn a lot from your posts :) – locus Jul 13 '18 at 22:32

0 Answers0