I have a model where I try to model the linear trend in my response over time The trend may vary by elevation and location
As far as I understood the mgcv
package in R, a GAM model would look like:
Y ~ Year + elevation + Year:elevation +s(lat, lon, bs="gp") +
ti(lat, lon, Year, d=c(2, 1), bs=c("gp", "tp"))
I have a gaussian error and identity link.
I saw ti()
is a tensor product interaction, but it is a non-linear interaction. I want a non-linear interaction for location but not for year, here I want just a slope
How can I estimate a slope for each location?
In linear regression considering only year and elevation I would sum the slope of year and the slope of my interaction with elevation (multiplied by my observed elevation) so b_Year + b_Year:elevation*elevation
but how do I do that for my location term? -or how to reparameterize?