weightComp: Computing weights from the degree of the inferred network

Description Usage Arguments Value Examples

View source: R/Functions.R

Description

This function computes weights from the degree of estimated network using the weighted Lasso approach

Usage

1
  weightComp(dat,lam=0.4,w.mb)

Arguments

dat

An input matrix. The columns represent variables and the rows indicate observations.

lam

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.

Value

d.mb

Weight vector computed from degree of the inferred network

Examples

 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)

# Compute weights from the inferred network
w.mb <- rep(1,p)
w.Mat <- weightComp(dat,lam=0.4,w.mb)

DWLasso documentation built on May 2, 2019, 7:27 a.m.

Related to weightComp in DWLasso...