Bayesian Networks in R by Radhakrishnan Nagarajan Marco Scutari & Sophie Lèbre

Bayesian Networks in R by Radhakrishnan Nagarajan Marco Scutari & Sophie Lèbre

Author:Radhakrishnan Nagarajan, Marco Scutari & Sophie Lèbre
Language: eng
Format: epub
Publisher: Springer New York, New York, NY


3.5.2 LASSO Learning: lars and simone

Several implementations of LASSO are available in R; in the following, we will use the lars package developed by Hastie and Efron (2012). Other possible choices are glmnet by Friedman et al. (2010) and penalized by Goeman (2012).

> library(lars)

Consider the arth800 MTS data set from the GeneNet package. arth800 describes the temporal expression of 800 genes of the Arabidopsis thaliana during the diurnal cycle. In the following example, we will consider a subset arth12 of 12 genes.

> library(GeneNet)

> data(arth800)

> subset = c(60, 141, 260, 333, 365, 424, 441, 512,

+ 521, 578, 789, 799)

> arth12 = arth800.expr[, subset]

Model estimation is performed using the lars function for a target variable specified by a vector (y) and a set of possible parents specified by a matrix of predictors (x). The arth800 data set is composed of 2 time series of 11 time points each: there are two repeated measurements for each time point. Suppose we want to estimate a VAR(1) process. Consequently, we removed the two repeated measurements for the first time point from y and the two repeated measurements for the last time point from x; they cannot be used for the LASSO due to the lack of the corresponding time points in x and y, respectively.

> x = arth12[1:(nrow(arth12) - 2), ]

> y = arth12[-(1:2), "265768_at"]

> lasso.fit = lars(y = y, x = x, type = "lasso")

Similarly, we can fit one LASSO model each target variable as follows.

> fit.all = lapply(colnames(arth12),

+ function(gene) {

+ y = arth12[-(1:2), gene]

+ lars(y = y, x = x, type = "lasso")

+ })

The order in which the coefficients for the parents are included in lasso.fit, which is the order in which the corresponding arcs are included in the gene expression network around the gene 265768_at, is shown in the left panel of Fig. 3.5 and is produced with the plot method for lars objects.

> plot(lasso.fit)

Fig. 3.5Graphical output from package lars. Left: learning process for lasso.fit. Arcs are included one at a time, and each inclusion is marked with a vertical line. Right: cross-validation estimates of the mean square error as a function of the fraction of the final value of the L 1 norm



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.