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
"gaussian","binomial"or"poisson", or the matching family object (defaultgaussian()).
Value
A list with fit (the morie_gam fit),
x_eval, y_hat (predictions), and edf
(effective degrees of freedom).
