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 that should be estimated using the glmnet implementation.
Control arguments passed to glmnet and the information-criterion-based shrinkage selection.

Details

gnet() constructs a model.matrix representation of the supplied formula and delegates estimation to glmnet inside the backfitting algorithm. The optimal penalty parameter is selected using an information criterion, with criterion = “bic” used by default.

Value

A special model-term object used internally by gamlss2.

See Also

la, gamlss2, specials.

Examples

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, model = "mu", term = "gnet(", element = "model")
print(class(sp))
plot(sp)