1

I'm using mgcv to fit a GAM model for two different decades in a large data set. After some previous analysis, I ended with a model that includes 3 different interactions, so it would be like:

 mod_period1  <- y ~ te(x1,x2) +  te(x3,x4) + te(x5,x6)

I would have another model with similar formulation for the period2.

Another option would be to fit one model using a categorical variable for period, so I was trying this as:

   mod  <- y ~ period + te(x1,x2, by=period) +  te(x3,x4) + te(x5,x6)

With both approaches, I am able to plot one surface (in particular, for the interaction between x1,x2) for each period. I know that the model with the interactions is not a simple case, but I was wondering whether it could be possible to estimate the differences in the smooth-factor interaction. I'd like to see how the surfaces obtained differ from each period. Is that possible ? Has anyone some advice about to address this?

Many thanks in advance,

0 Answers0