Description Usage Arguments References Examples
This function infers the network using nodewise regression method by Meinhausen and Buhlmann.
1 | MBLasso(dat,lambda=0.4,w.mb)
|
dat |
An input matrix. The columns represent variables and the rows indicate observations. |
lambda |
A penalty parameter of the weighted Lasso that controls the sparsity of the inferred network. |
w.mb |
An unput weight vector which is computed from the degree of the inferred network. |
Meinshausen, Nicolai, and Peter B<c3><bc>hlmann. "High-dimensional graphs and variable selection with the lasso." The annals of statistics (2006): 1436-1462.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | library(DWLasso)
library(glmnet)
library(hglasso)
# Generate inverse covariance matrix with 3 hubs
# 20 % of the elements within a hub are zero
# 97 % of the elements that are not within hub nodes are zero
p <- 60 # Number of variables
n <- 40 # Number of samples
hub_number = 3 # Number of hubs
# Generate the adjacency matrix
Theta <- HubNetwork(p,0.97,hub_number,0.2)$Theta
# Generate a data matrix
out <- rmvnorm(n,rep(0,p),solve(Theta))
# Standardize the data
dat <- scale(out)
# Infer the network using weighted nodewise regression
w.mb <- rep(1,p)
adj.mat <- MBLasso(dat,lambda=0.4,w.mb)
|
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-16
Loading required package: glasso
Loading required package: mvtnorm
Loading required package: igraph
Attaching package: 'igraph'
The following objects are masked from 'package:stats':
decompose, spectrum
The following object is masked from 'package:base':
union
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.