Usage
learner_gam(
formula,
info = "mgcv::gam",
family = gaussian(),
select = FALSE,
gamma = 1,
learner.args = NULL,
...
)Arguments
- formula
(formula) Formula specifying response and design matrix.
- info
(character) Optional information to describe the instantiated learner object.
- family
This is a family object specifying the distribution and link to use in fitting etc (see
glmandfamily). Seefamily.mgcvfor a full list of what is available, which goes well beyond exponential family. Note thatquasifamilies actually result in the use of extended quasi-likelihood ifmethodis set to a RE/ML method (McCullagh and Nelder, 1989, 9.6).- select
If this is
TRUEthengamcan add an extra penalty to each term so that it can be penalized to zero. This means that the smoothing parameter estimation that is part of fitting can completely remove terms from the model. If the corresponding smoothing parameter is estimated as zero then the extra penalty has no effect. Usegammato increase level of penalization.- gamma
Increase this beyond 1 to produce smoother models.
gammamultiplies the effective degrees of freedom in the GCV or UBRE/AIC.n/gammacan be viewed as an effective sample size in the GCV score, and this also enables it to be used with REML/ML. Ignored with P-RE/ML or theefsoptimizer.- learner.args
(list) Additional arguments to learner$new().
- ...
Additional arguments to mgcv::gam.
Value
learner object.
Examples
n <- 5e2
x1 <- rnorm(n, sd = 2)
x2 <- rnorm(n)
y <- x1 + cos(x1) + rnorm(n, sd = 0.5**.5)
d0 <- data.frame(y, x1, x2)
lr <- learner_gam(y ~ s(x1) + x2)
lr$estimate(d0)
if (interactive()) {
plot(lr$fit)
}
