Skip to contents

g(mu) = alpha + sum_j f_j(X_j) with each f_j a cubic smoothing spline of penalty lambda_j, fitted by backfitting with re-centred components (ESL Alg. 9.1, eq 9.7); g = "logit" uses local scoring, weighted backfitting on the working response (ESL Alg. 9.2). smoother = "linear" fits straight lines.

Usage

morie_esl_gam(
  X,
  y,
  g = NULL,
  lambdas = 1,
  smoother = c("spline", "linear"),
  max_iter = 500,
  tol = 1e-10,
  max_outer = 100
)

Arguments

X

Predictors without an intercept column, n by p.

y

Response (0/1 for the logit link).

g

NULL, "identity" or "logit".

lambdas

One penalty or one per predictor.

smoother

"spline" or "linear".

max_iter, tol, max_outer

Iteration controls.

Value

Named list: estimate, alpha, partial_fits (n by p), fitted, eta, iterations, converged, and rss or loglik.

References

Hastie, T. & Tibshirani, R. (1990). Generalized Additive Models. Chapman & Hall.

Examples

i <- 1:40
X <- cbind(((7 * i) %% 41) / 41 * 3, ((11 * i) %% 43) / 43 * 2)
morie_esl_gam(X, sin(2 * X[, 1]) + X[, 2]^2, lambdas = c(0.05, 0.2))$alpha
#> [1] 1.314774