R6 abstract class for a generic sparse Normal Block model
R6 abstract class for a generic sparse Normal Block model
Active bindings
inference_method
inference procedure used (heuristic or integrated with EM)
n
number of samples
p
number of responses per sample
d
number of variables (dimensions in X)
d0
number of zi variables (dimensions in X0)
Q
number of blocks
n_edges
number of edges of the network (non null coefficient of the sparse precision matrix OmegaQ)
model_par
a list with the matrices of the model parameters: B (covariates), dm1 (species variance), OmegaQ (groups precision matrix))
nb_param
number of parameters in the model
objective
evolution of the objective function during (V)EM algorithm
loglik
(or its variational lower bound)
deviance
(or its variational lower bound)
BIC
(or its variational lower bound)
entropy
Entropy of the conditional distribution when applicable
ICL
variational lower bound of the ICL
EBIC
variational lower bound of the EBIC
criteria
a vector with loglik, BIC and number of parameters
sparsity
(overall sparsity parameter)
sparsity_weights
(weights associated to each pair of groups)
sparsity_term
(sparsity_term term in log-likelihood due to sparsity)
get_res_covariance
whether the residual covariance is diagonal or spherical
memberships
cluster memberships
clustering
given as the list of elements contained in each cluster
cluster_sizes
given as a vector of cluster sizes
elements_per_cluster
given as the list of elements contained in each cluster
Methods
Method new()
Create a new [`NB`] object.
Usage
NB$new(data, Q, sparsity = 0, control = NB_control())
Method update()
Update a [`NB`] object
All possible parameters of the child classes
Usage
NB$update(
B = NA,
dm1 = NA,
C = NA,
OmegaQ = NA,
gamma = NA,
mu = NA,
kappa = NA,
alpha = NA,
M = NA,
S = NA,
ll_list = NA
)
Arguments
B
regression matrix
dm1
diagonal vector of inverse variance matrix (variables level)
C
the matrix of groups memberships (posterior probabilities)
OmegaQ
groups inverse variance matrix
gamma
variance of posterior distribution of W
mu
mean for posterior distribution of W
kappa
vector of zero-inflation probabilities
alpha
vector of groups probabilities
M
variational mean for posterior distribution of W
S
variational diagonal of variances for posterior distribution of W
ll_list
list of log-lik (elbo) values
Method optimize()
calls optimization (EM or heuristic) and updates relevant fields
Usage
NB$optimize(control = list(niter = 100, threshold = 1e-04))
Method split()
Create a clone of the current [`NB`] object after splitting cluster `cl` We split the cluster according to the species variances
Method candidates_split()
generate and select a set of candidate models by splitting the clusters of the current model
Method candidates_merge()
generate and select a set of candidate models by merging the clusters of the current model
Method merge()
Create a clone of the current [`NB`] object after merging clusters `cl1` and `cl2`
Method latent_network()
Extract interaction network in the latent space
Usage
NB$latent_network(type = c("partial_cor", "support", "precision"))
Method plot_network()
plot the latent network.
Usage
NB$plot_network(
type = c("partial_cor", "support"),
output = c("igraph", "corrplot"),
edge.color = c("#F8766D", "#00BFC4"),
remove.isolated = FALSE,
node.labels = NULL,
layout = igraph::layout_in_circle,
plot = TRUE
)
Arguments
type
edge value in the network. Either "precision" (coefficient of the precision matrix) or "partial_cor" (partial correlation between species).
output
Output type. Either `igraph` (for the network) or `corrplot` (for the adjacency matrix)
edge.color
Length 2 color vector. Color for positive/negative edges. Default is `c("#F8766D", "#00BFC4")`. Only relevant for igraph output.
remove.isolated
if `TRUE`, isolated node are remove before plotting. Only relevant for igraph output.
node.labels
vector of character. The labels of the nodes. The default will use the column names ot the response matrix.
layout
an optional igraph layout. Only relevant for igraph output.
plot
logical. Should the final network be displayed or only sent back to the user. Default is `TRUE`.