A penalised-spline alternative to the kernel methods above. Fits
y ~ s(x, k = k) and returns fitted values at x_eval.
Usage
gam_smoother(x, y, x_eval = NULL, k = 10, family = stats::gaussian())Arguments
- x
Numeric covariate vector.
- y
Numeric outcome vector.
- x_eval
Evaluation grid (defaults to
x).- k
Basis dimension for the smoother (default 10).
- family
GLM family for
mgcv::gam(defaultgaussian()).