Learn R Programming

ER (version 1.1.1)

elastic: Elastic-net modeling of ER objects.

Description

Elastic-net modeling of ER objects.

Usage

elastic(er, ...)

# S3 method for ER elastic( er, effect, alpha = 0.5, newdata = NULL, validation, segments = NULL, measure = measure, family = family, ... )

Arguments

er

Object of class ER.

...

Additional arguments for pls::cvsegments.

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'.

See Also

ER, pls and confints.

Examples

Run this code
## Multiple Sclerosis data
data(MS, package = "ER")
er <- ER(proteins ~ MS * cluster, data = MS)
elasticMod <- elastic(er, '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,s='lambda.min',exact=TRUE)
(selected <- rownames(coefs[[1]])[unique(unlist(lapply(coefs,
                      function(x)which(as.vector(x) != 0))))][-1])

# \donttest{
## Diabetes data
data(Diabetes, package = "ER")
er.Dia <- ER(transcriptome ~ surgery * T2D, data = Diabetes)
elasticMod <- elastic(er.Dia, 'T2D', validation = "LOO")
# }

Run the code above in your browser using DataLab