[R-sig-ME] Interaction between random and fixed effects

Vinicius Maia v|n|c|u@@@@m@|@77 @end|ng |rom gm@||@com
Mon May 31 21:20:38 CEST 2021

Dear Thierry,

Thank you for your response.
Local is coded with the name of the local, but I believe the nesting is
implicit in the data.

with(dataset, isNested(as.character(Local), as.character(Year)))
returns TRUE

The example is attached.

Best wishes,


Em seg., 31 de mai. de 2021 às 16:10, Thierry Onkelinx <
thierry.onkelinx using inbo.be> escreveu:

> Dear Vinicius,
> What did you ran the interaction as a fixed effect Year:Local or a
> random effect (1|Year:Local)?  How did you code Local: as a unique value
> for every Local and Year combinations? Please do share output or a minimal
> example so we know exactly what you did. I'm still a novice at mind reading.
> Best regards,
> ir. Thierry Onkelinx
> Statisticus / Statistician
> Vlaamse Overheid / Government of Flanders
> Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
> thierry.onkelinx using 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
> ///////////////////////////////////////////////////////////////////////////////////////////
> <https://www.inbo.be>
> Op ma 31 mei 2021 om 20:57 schreef Vinicius Maia <
> vinicius.a.maia77 using gmail.com>:
>> Hi all,
>> I have a subtle doubt in how to interpret the interaction between fixed
>> (or
>> even random) and random effects in the following case.
>> I have a model: Y ~ Year + (1|Local)+(1|Genotype) + (Year:Local:Genotype)
>> Year is a fixed effect because it has only 4 levels.
>> I ran the model with the random and fixed effect interaction just to
>> explore, but I was not expecting that it would work because Locals are
>> completely nested within Years.
>> To my surprise, the model ran and the variance of Year:Local:Genotype are
>> quite big. How is it possible to have Local interacting with Year if they
>> are nested? I also tried: Y ~ Year + (1|Local)+(1|Genotype) + (Year:Local)
>> and the model rans too, without singular fit.
>> I am struggling to understand if random interactions (it also extends to
>> cases where the interactions are only between nested random effects) mean
>> that the variance between Locals changes with Years or if the effect of a
>> given Local changes with Years. If it is the former option I can
>> understand
>> why the model ran and has a high variance for the interaction, but if it
>> is
>> the later case (which I believe it is), how does the model estimate an
>> interaction for Local:Year if they are nested?
>> Thanks!
>> Best wishes,
>> Vinícius Maia
>>         [[alternative HTML version deleted]]
>> _______________________________________________
>> R-sig-mixed-models using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

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