library("gamlss2")
air <- subset(airquality, !is.na(Ozone))
air$Tc <- cut(air$Temp, breaks = seq(50, 100, by = 10),
include.lowest = TRUE)
air$Wc <- cut(air$Wind, breaks = seq(2, 22, by = 4),
include.lowest = TRUE)
## model formula, for each parameter we use
## the same gnet() model term
f <- Ozone ~ gnet(~Tc + Wc) | .
## estimate model
m <- gamlss2(f, data = air, family = NO)
## summary with edf
summary(m)
## plot coefficient paths
sp <- specials(m, parameter = "mu", terms = "gnet(~Tc+Wc)", elements = "model")
print(class(sp))
plot(sp)Model Terms with glmnet
Description
Constructor for estimating penalized model terms using the glmnet package.
Usage
gnet(formula, ...)
Arguments
formula
|
A formula specifying the covariates for the penalized term. |
…
|
criterion selects the information criterion: “bic” (default), “aic”, “aicc”, “gaic”, or “gcv”. Other arguments are passed to glmnet, including alpha (elastic-net mixing parameter), lambda (penalty sequence), nlambda (number of penalties), and standardize (whether to standardize covariates).
|
Details
gnet() constructs a model.matrix from the formula, removes its intercept column, and fits the term using glmnet within backfitting. The penalty lambda minimizes the selected criterion. For criterion = “gaic”, the multiplier K is set in gamlss2_control (default: 2).
Value
A special model-term object used internally by gamlss2.
See Also
la, gamlss2, specials.