joinet: Multivariate Elastic Net Regression

Description Usage Arguments Details Value References See Also Examples

View source: R/functions.R

Description

Implements multivariate elastic net regression.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
joinet(
  Y,
  X,
  family = "gaussian",
  nfolds = 10,
  foldid = NULL,
  type.measure = "deviance",
  alpha.base = 1,
  alpha.meta = 1,
  weight = NULL,
  sign = NULL,
  ...
)

Arguments

Y

outputs: numeric matrix with n rows (samples) and q columns (outputs)

X

inputs: numeric matrix with n rows (samples) and p columns (inputs)

family

distribution: vector of length 1 or q with entries "gaussian", "binomial" or "poisson"

nfolds

number of folds

foldid

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

type.measure

loss function: vector of length 1 or q with entries "deviance", "class", "mse" or "mae" (see cv.glmnet)

alpha.base

elastic net mixing parameter for base learners: numeric between 0 (ridge) and 1 (lasso)

alpha.meta

elastic net mixing parameter for meta learners: numeric between 0 (ridge) and 1 (lasso)

weight

input-output relations: matrix with p rows (inputs) and q columns (outputs) with entries 0 (exclude) and 1 (include), or NULL (see details)

sign

output-output relations: matrix with q rows ("meta-inputs") and q columns (outputs), with entries -1 (negative), 0 (none), 1 (positive) and NA (any), or NULL (see details)

...

further arguments passed to glmnet

Details

input-output relations: In this matrix with p rows and q columns, the entry in the jth row and the kth column indicates whether the jth input may be used for modelling the kth output (where 0 means "exclude" and 1 means "include"). By default (sign=NULL), all entries are set to 1.

output-output relations: In this matrix with q rows and q columns, the entry in the lth row and the kth column indicates how the lth output may be used for modelling the kth output (where -1 means negative effect, 0 means no effect, 1 means positive effect, and NA means any effect).

There are three short-cuts for filling up this matrix: (1) sign=1 sets all entries to 1 (non-negativity constraints). This is useful if all pairs of outcomes are assumed to be positively correlated (potentially after changing the sign of some outcomes). (2) code=NA sets all diagonal entries to 1 and all off-diagonal entries to NA (no constraints). (3) sign=NULL uses Spearman correlation to determine the entries, with -1 for significant negative, 0 for insignificant, 1 for significant positive correlations.

elastic net: alpha.base controls input-output effects, alpha.meta controls output-output effects; lasso renders sparse models (alpha=1), ridge renders dense models (alpha=0)

Value

This function returns an object of class joinet. Available methods include predict, coef, and weights. The slots base and meta each contain q cv.glmnet-like objects.

References

Armin Rauschenberger, Enrico Glaab (2021) "Predicting correlated outcomes from molecular data" Bioinformatics. btab576 doi: 10.1093/bioinformatics/btab576

See Also

cv.joinet, vignette

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
n <- 50; p <- 100; q <- 3
X <- matrix(rnorm(n*p),nrow=n,ncol=p)
Y <- replicate(n=q,expr=rnorm(n=n,mean=rowSums(X[,1:5])))
object <- joinet(Y=Y,X=X)
## End(Not run)

## Not run: 
browseVignettes("joinet") # further examples
## End(Not run)

joinet documentation built on Aug. 9, 2021, 9:13 a.m.