This is not a coding question. Is there a statistical method for adding a smooth time effect to a glm or mixed model (lm, glm, lmer, etc.).
- I am aware of ARIMA and exponential time smoothing models with exogenous variables, but not sure if they could work for problems where logistic regression model or a mixed models are required
- I can consider addition a categorical variable for year-month but that would not be a smooth effect. Likely overfit? And no within-month time variation explained. Is this the best I can do?
- I can consider a polynomial for time but that will limit the sophistication of the time effect and will require that I know an appropriate functional form for the shape
- I can consider a time series model fit on the residuals of the glm / mixed model, but that would have the drawback that the two models are fully separate and the time effects are not taken into consideration for fitting the glm /mixed model coefficients.