4.7 Generalized Additive Models

lm_gam <- mgcv::gam(Sale_Price ~ s(total_sf) + bath + Lot_Area + Bedroom_AbvGr, 
                    data = dat)
gam <- ggeffects::ggpredict(lm_gam, "total_sf")
plot(gam, residuals = TRUE, residuals.line = TRUE)
## `geom_smooth()` using formula 'y ~ x'