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")



## transform to categorical
rent$Flc <- cut(rent$Fl, breaks = seq(20, 160, by = 10),
  include.lowest = TRUE)
rent$Ac <- cut(rent$A, breaks = seq(1890, 1990, by = 10),
  include.lowest = TRUE)

## model formula, for each parameter we use
## the same gnet() model term
f <- R ~ gnet(~Flc + Ac + loc) | . | . | .

## estimate model
m <- gamlss2(f, data = rent, family = BCT)

## summary with edf
summary(m)

## plot coefficient paths
sp <- specials(m, model = "mu", term = "gnet(", element = "model")
print(class(sp))
plot(sp)