[R-sig-ME] 3-way interaction in random structure using gam

Thierry Onkelinx th|erry@onke||nx @end|ng |rom |nbo@be
Tue May 25 13:34:37 CEST 2021


Dear Rudi,

Please keep the mailing list in cc.

Yes. I'd use the model with only the 3-way interaction smoother. It can
handle all patterns of the lower interactions.

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 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 di 25 mei 2021 om 13:30 schreef Rudi Reiner <rudi.reiner using boku.ac.at>:

> Dear Thierry,
>
> thank you for your reply. I am afraid, there was a typing error in my
> initial message. Age and b.mass do have a non-linear (not lon or log
> linear) relationship. Simplified, it may be a quadratic one (see me model
> using lmer) but I think a gam would fit better. So would you still suggest
> this model?:
>
>  gam(b.mass ~ te(age, area.forest, by = period), data = data, random =
> list(pop=~1, year=~1))
>
> Best regards,
> Rudi
>
> Am 25.05.2021 um 13:04 schrieb Thierry Onkelinx:
>
> Dear Rudi,
>
> If age has a log-linear relationship, then use logAge as predictor rather
> than age.
>
> I'm wondering why you insist on adding the 2-way interactions smoothers.
> You can't directly interpret 2-way interactions (or main effects) when you
> have a 3-way interaction that contains the same variables.
>
> I'd simplify the model to  gam(b.mass ~ te(log.age, area.forest, by =
> period), data = data, random = list(pop=~1, year=~1)).
>
> 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 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 di 25 mei 2021 om 09:14 schreef Rudi Reiner <rudi.reiner using boku.ac.at>:
>
>>
>> Hi there,
>>
>> my actually trying to fit a non-linear mixed model (with a random
>> structure) and am not sure how to do this correct using "gam" or "bam"
>> from the mgcv package. My supervisor suggested me to ask R-sig.
>>
>> My Data:
>>
>> b.mass = body mass (continuous) - dependent variable
>> _
>> __predictor variables_
>> age = continuous; lon-linear relationship with b.mass
>> area.forest = continuous
>> period =  factor; 2 levels
>>
>> _random variables
>> _year = continuous (1993-2019)
>> pop = factor (28 different populations)
>> --------------------------------------------------
>>
>> First I fitted a linear model with quadratic age which seems to give me
>> the "correct" results (biologically the results make sense). Especially
>> I am interested in the 3-way interaction age x area.forest x period but
>> also want/have to add all 2-way interactions:
>>
>> */LM <- lmer(b.mass ~ ns(age,2)*area.forest*period + (1|pop)+ (1|year),
>> data = data)/*
>>
>> Now I want to have the corresponding model using gam (or bam). I tried:
>>
>> */gam <- gam(b.mass ~ period+s(age)+area.forest+s(age, by =
>> area.forest)+s(age, by=period)+te(area.forest, by=period)+te(age,
>> area.forest, by = period), data = data, random = list(pop=~1, year=~1))/*
>>
>> The results (plot age~b.mass for different area.forest) look different
>> to the lmer approach. Do have an idea, if my model (gam) is fitted
>> correct, i.e., is it the "same" like the model I fitted using /`lmer`?/
>>
>> Thank you,
>> Rudi
>>
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> 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