I am new to the exchange and self-teaching myself GAM (via mgcv package).
Context: I would like to estimate a panel regression via gam
.
- periodicity: monthly
- balanced panel
Question: may I estimate a GAM to include a global trend and local trend and random? It would look like this:
model_1 = gam(Y ~ X + s(LOCATION, bs="re") + s(time, by=COUNTRY),
data= dat, correlation = corAR1(form = ~ 1 | LOCATION),
method = "REML",...)
The first smooth term (i.e., s(LOCATION, bs="re")
) is a random intercept. The second is a non-parametric trend by location. Is this model appropriate, as I would like to model the panel in this way? I am intentionally simplifying in hopes it does strips away unneeded complexity.
Very grateful for any advice!