How to build a correct GAM model with repeated measurement and replicates?

i made an experiment with repeated measurement depending on time scale and I was advised to use GAM model to describe my data.

I made an experiment on 12 mesocosms (big tanks) for 6 weeks to test the crossed effect of two treatment A (TA) and B (TB) on the variation of chlorophyll. Each treatment were composed of two modalities : A1 or A2, B1 or B2. Each modalities were crossed and replicates three times, so at the end a worked on 4 combinaisons of treatments:

3 tanks (replicates) submitted to A1+ B1 3 tanks (replicates) submitted to A1+ B2 3 tanks (replicates) submitted to A2+ B1 3 tanks (replicates) submitted to A2+ B2

Each two or three days, we measured the concentration of chlorophyll on each tank. So I need to include in my model : a)that there was a repeated measurement on a same tank b)and in addition there were replicates in each treatment.

My variables are:

date : num (I wrote them in julian date format, for example: 2 sept= 245th day of the year)
tank: factor with 12 levels (different tanks)
TA = factor with two modalities (A1 et A2)
TB = factor with two modalities (B1 et B2)
treat = crossed treatments A1_B1, A1_B2, A2_B1, A2_B2
chloro = response variable


I’m new with GAM models and that’s why i ask for help to better understand the model i wrote and to better construct them. I first wanted to write simples models and then more complex and to visualize them of a graph (see figure, Be careful, the templates are not displayed in the right order but in the following order: mod 1, mod 10, mod 11, mod 2, mod 3, mod 4, mod 5, mod 6 mod 7, mod 8, mod 9 ).

I would like to know :

  1. How to write correctly the « repeated measurement » i made taking into account replicates ? In linear regression, i write it as random effect « (1|variable) » , however here, i realized that there is a lot of possibility to write the model.
    I didn’t understand the difference between these functions :
    s(tank, bs=« re ») and s(date, tank, bs=c(« fs »))
    And between : s(date, tank, bs=c(« fs »)) and s(date, tank, bs=c(« fs », « re »)) and ?

Especially as models seems identical (mod 1 vs mod 3 in the graph) How to know which correct writing to choose ?

  1. When i remove the tank effect of the model (mod 7) and test only the effect of treatment, i observed that all my predictions were very bad and do not fit as expected my data. I’ve the impression that my variable « tank » was able to explain by itself all my data in previous models… Does this mod 7 suggest that my treatment variable has no effect on my response variable?
  2. When i wrote categorial predictors as in linear regression (mod 6, 8, 9 & 10) outside of a smooth function, i didn’t see the difference with models were these predictors were not present (as in mod 3 or 4).
  3. How to choose between all these models, the best one ? Do i have to compare models with AIC comparison or is there other method to choose ?
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.