4 ms·
You should look into using generalized additive models (GAMs). They are regression models that allow you to model nonlinear relationships, and even smooth nonli
by levocardia 3y ago
You should look into using generalized additive models (GAMs). They are regression models that allow you to model nonlinear relationships, and even smooth nonlinear interactions between variables, while retaining the benefits of classical regression models like statistically valid confidence intervals and the ability to control for repeated measures. You can also explicitly model periodic behavior, like 24-hour or annual cycles in a predictor variable, and even account for auto-correlation explicitly.
In your example, you could not only pinpoint departure from linearity, but you could get a 95% confidence interval for it.
The best implementation is mgcv in R; pyGAM in python is ok but lacks many of the more advanced features in mgcv. There's even a more ML-flavored implementation in mboost