I need some help justifying my choice of syntax in mgcv for a gam model.
As I understand it, there are 2 schools of thought: 1. time (year) can either be a continuous trend or a factor, but not both (it’s basically representing the same effect twice). 2. One CAN use both versions in the same model, because one term can represent the smooth annual trend while an additional factor year random effect captures the high year-to-year variation. Is there some way to determine (residual plots, examine variance components, etc.) which method is correct?
If it’s a reasonable model to assume, is this the proper syntax in mgcv? abundance ~ s(year) + s(fsite, fyear, bs="re") + s(fsite,bs="re")
fsite = repeated measures per site
fyear = factor year (15 years)
year = continious year (trend)
Thanks, Bob! No problem, I’m not well versed in mgcv syntax either! Maybe you can help me with this one: Would you also have a fixed effect for a year x season interaction, as well as a random effect of that interaction for the same reason (capture main trend and the random variation)? Or would that be redundant - even it explained a large portion of the variance? Just trying to get a handle on when to include a variable more than once.