I know similar questions have come up a lot but I'm still confused on how to model interactions in GAM (using
mgcv in R). In my analysis, my response variable has normally distributed residuals and the variable is related to three continuous variables.
My goal is to predict values of y over a range of values of the continuous predictors. Also, I would like to compare the estimated slopes (and smooths?) to simulated data. I believe there are interactions between the continuous predictors.
Upon visual inspection it seems the relationship between y and one of the continuous predictors is non-linear. Hence, I will use GAM. With two linear predictors and one non-linear predictor what would be the appropriate model? One that simply includes all interactions in a tensor product?
y = a + te(x1, x2, x3)
But if x2 and x3 are linearly related to y then:
y = a + te(x1, x2) + te(x1, x3) + b1(x2) + b2(x3) + b3(x2:x3)
y = a + s(x1) + b1(x2) + b2(x3) + b3(x1:x2) + b4(x1:x3) + b5(x2:x3)
Or, we can throw
ti() into the mix:
y = a + ti(x1) + b1(x2) + b2(x3) + ti(x1:x2) + ti(x1:x3) + b3(x2:x3)