zilgm: Undirected Local Graphical Models for Count data with excess...

View source: R/ZILGM.R

zilgmR Documentation

Undirected Local Graphical Models for Count data with excess zeros and overdispersion

Description

Network estimation following local markov property for count data with zero inflated and overdispersion by specified node-conditional distribution

Usage

zilgm(X, lambda = NULL, nlambda = 50, family = c("Poisson", "NBI", "NBII"), 
      update_type = c("IRLS", "MM"), sym = c("AND", "OR"), theta = NULL, thresh = 1e-6, 
	  weights_mat = NULL, penalty_mat = NULL, do_boot = FALSE, boot_num = 10,
	  beta = 0.05, lambda_min_ratio = 1e-4, init_select = FALSE, nCores = 1, verbose = 0, ...)

Arguments

X

A n x p data matrix, where n is the number of observations and p is the number of variables or nodes.

lambda

A sequence of regularization parameter to control a level of l_1-penalty.

nlambda

The number of regularization parameter. If lambda is given, this argument is ignored.

family

Types of node-conditional distribution to be assumed among zero-inflated distributions.

update_type

Algorithm for estimating edge coefficients.

sym

Symmetrize the output graphs. If sym = "AND", the edge between node i and node j is selected only when both node i and node j are selected as neighbors for each other. If sym = "OR", the edge is selected when either node i or node j is selected as the neighbor for each other.

theta

A dispersion parameter. If type = "NBII", theta denote the dispersion parameter in the ZILNBGM-II. If the argument is given value, the ZILNBGM estimates the graphs using this dispersion parameter without estimating the dispersion parameters for each variable.

thresh

Threshold value for the estimated edge coefficients.

weights_mat

A n x p matrix containing weights for observations in each node

penalty_mat

A p x p matrix containing weights for each edge coefficients

do_boot

A logical. Whether to use Stability Apprach to Regularization Selection (StARS).

boot_num

The number of iteration for StARS.

beta

Threshold value on sparsity of the network.

lambda_min_ratio

The smallest value for lambda, as a fraction of the lambda^max of the regularization parameter. This factor is used by nlambda to automatically compute the sequence of the regularization parameter.

init_select

A logical. Whether to use initial selection.

nCores

The number of cores to use for parallel computing.

verbose

An optional integer value, If verbose = 1, information of regularization parameter and learning node are printed. Default is verbose = 0.

...

Other arguments that can be passed to neighborhood selection function.

Value

An S3 object with the following slots

network

a list of p x p matrices of estimated networks along the regularization path.

coef_network

a array of p x p x nlambda of estimated edge coefficients matrix along the regularization path.

lambda

vector used for regularization path.

v

vector of network variability measured for each regularization level.

opt_lambda

The lambda that gives the optimal network.

References

Choi, H., J. Gim, S. Won, Y. J. Kim, S. Kwon, and C. Park, 2017: Network analysis for count data with excess zeros. BMC genetics, 18, no. 1, 1-10.
Park, B., H. Choi, C. Park, 2021: Negative binomial graphical model with excess zeros.

Examples

require(ZILGM)
set.seed(1)
n = 100; p = 10; prob = 2 / p;
A = generate_network(p, prob, type = "random")
simul_dat = zilgm_sim(A = A, n = n, p = p, zlvs = 0.1, 
					  family = "negbin", signal = 1.5, theta = 0.5, noise = 0.0)
					  
# Compute a sequence of regularization parameter
lambda_max = find_lammax(simul_dat$X)
lambda_min = 1e-4 * lambda_max
lambs = exp(seq(log(lambda_max), log(lambda_min), length.out = 50))
nb2_fit = zilgm(X = simul_dat$X, lambda = lambs, family = "NBII", update_type = "IRLS", 
                do_boot = TRUE, boot_num = 30, sym = "OR", nCores = 10)

# To compute the regularization parameters automatically, use the argument nlambda
nb2_fit = zilgm(X = simul_dat$X, nlambda = 50, family = "NBII", update_type = "IRLS",
                do_boot = TRUE, boot_num = 30, sym = "OR", nCores = 10)
				
# Get estimated graph
est_graph = nb2_fit$network[[nb2_fit$opt_index]]

bbeomjin/ZILGM documentation built on Aug. 5, 2023, 5:52 a.m.