One of the most significant benefits of local regression is that it allows you to easily estimate a regularized derivative. It's practically the best method for differentiating any measurements.
If you fit a GAM using splines, it's just fit using least squares (lm() in R) so you can construct the individual functions (f1, f2) based on the linear model coefficients and the spline transformations. If LOESS or something like smoothing splines are used, I'm not aware of a way to get the functions directly. In general, a workaround is to construct them by hand: create a vector of input values across the domain of a given predictor X (e.g., a little beyond the range of the observed data), set the other predictors to a constant value, use the fitted GAM to predict the outcome across the values of the predictor X--> this gives you input-output pairs that describe the function. Then you can repeat for the other predictors.
Thank you for this video! All the info was very well-put and easy to follow.
Agreed
One of the most significant benefits of local regression is that it allows you to easily estimate a regularized derivative. It's practically the best method for differentiating any measurements.
Amazing.
Amazing work, thank you!
Really helpful! Cheers
Video goes hard
Is there a way to output the fitted spline for each predictor explicitly, e.g. f1(year), f2(age), either with R or Python packages?
If you fit a GAM using splines, it's just fit using least squares (lm() in R) so you can construct the individual functions (f1, f2) based on the linear model coefficients and the spline transformations. If LOESS or something like smoothing splines are used, I'm not aware of a way to get the functions directly. In general, a workaround is to construct them by hand: create a vector of input values across the domain of a given predictor X (e.g., a little beyond the range of the observed data), set the other predictors to a constant value, use the fitted GAM to predict the outcome across the values of the predictor X--> this gives you input-output pairs that describe the function. Then you can repeat for the other predictors.
Check out the `gratia` package, which has some awesome helper function
Excellent. How do we implement this in SAS?
I'm not a SAS user, but this page seems to have more information: support.sas.com/rnd/app/stat/procedures/gam.html
Please share codes in desciption box