elastic {gemR}R Documentation

Elastic-net modeling of GEM objects.

Description

Elastic-net modeling of GEM objects.

Usage

elastic(gem, ...)

## S3 method for class 'GEM'
elastic(
  gem,
  effect,
  alpha = 0.5,
  newdata = NULL,
  validation,
  segments = NULL,
  measure = measure,
  family = family,
  ...
)

Arguments

gem

Object of class GEM.

...

Additional arguments for glmnet.

effect

The effect to be used as response.

alpha

The elasticnet mixing parameter.

newdata

Optional new data matrix for prediction.

validation

Optional validation parameters.

segments

number of segments or list of segments (optional)

measure

Type of performance summary, default = 'class' (see glmnet)

family

Type of model response, default = 'multinomial'.

Value

An object of class GEMglmnet, cv.glmnet, list containing the fitted Elastic-net model, classifications/predictions and data.

See Also

Analyses using GEM: pca, sca, neuralnet, pls. Confidence interval plots: confints. Convenience knock-in and knock-out of effects: knock.in.

Examples

## Multiple Sclerosis data
data(MS, package = "gemR")
# Subset to reduce runtime in example
MS$proteins <- MS$proteins[,20:70]

gem <- GEM(proteins ~ MS * group, data = MS)
elasticMod <- elastic(gem, 'MS', validation = "CV")
sum(elasticMod$classes == MS$MS)
plot(elasticMod)            # Model fit
plot(elasticMod$glmnet.fit) # Coefficient trajectories

# Select all proteins with non-zeros coefficients
coefs     <- coef(elasticMod)
(selected <- names(which(coefs[,1] != 0)))

 # Time consuming due to many variables
  ## Diabetes data
  data(Diabetes, package = "gemR")
  gem.Dia <- GEM(transcriptome ~ surgery * T2D, data = Diabetes)
  elasticMod <- elastic(gem.Dia, 'T2D', validation = "LOO")


[Package gemR version 1.2.1 Index]