Implements stacked elastic net regression.

starnet(
  y,
  X,
  family = "gaussian",
  nalpha = 21,
  alpha = NULL,
  nfolds = 10,
  foldid = NULL,
  type.measure = "deviance",
  alpha.meta = 1,
  penalty.factor = NULL,
  intercept = NULL,
  upper.limit = NULL,
  unit.sum = NULL,
  ...
)

Arguments

y

response: numeric vector of length \(n\)

X

covariates: numeric matrix with \(n\) rows (samples) and \(p\) columns (variables)

family

character "gaussian", "binomial" or "poisson"

nalpha

number of alpha values

alpha

elastic net mixing parameters: vector of length nalpha with entries between \(0\) (ridge) and \(1\) (lasso); or NULL (equidistance)

nfolds

number of folds

foldid

fold identifiers: vector of length \(n\) with entries between \(1\) and nfolds; or NULL (balance)

type.measure

loss function: character "deviance", "class", "mse" or "mae" (see cv.glmnet)

alpha.meta

meta-learner: value between \(0\) (ridge) and \(1\) (lasso) for elastic net regularisation; NA for convex combination

penalty.factor

differential shrinkage: vector of length \(n\) with entries between \(0\) (include) and \(Inf\) (exclude), or NULL (all \(1\))

intercept, upper.limit, unit.sum

settings for meta-learner: logical, or NULL (intercept=!is.na(alpha.meta), upper.limit=TRUE, unit.sum=is.na(alpha.meta))

...

further arguments passed to glmnet

Value

Object of class starnet. The slots base and meta contain cv.glmnet-like objects, for the base and meta learners, respectively.

Details

Post hoc feature selection: consider argument nzero in functions coef and predict.

References

Armin Rauschenberger, Enrico Glaab, and Mark A. van de Wiel (2021). "Predictive and interpretable models via the stacked elastic net". Bioinformatics 37(14):2012-2016. doi:10.1093/bioinformatics/btaa535 . (Click here to access PDF.)

Examples

# \donttest{
set.seed(1)
n <- 50; p <- 100
y <- rnorm(n=n)
X <- matrix(rnorm(n*p),nrow=n,ncol=p)
object <- starnet(y=y,X=X,family="gaussian")# }