Skip to contents

An R6 Class to represent a ZIPLNfit in a standard, general framework, with sparse inverse residual covariance

Super class

ZIPLNfit -> ZIPLNfit_sparse

Active bindings

penalty

the global level of sparsity in the current model

penalty_weights

a matrix of weights controlling the amount of penalty element-wise.

n_edges

number of edges if the network (non null coefficient of the sparse precision matrix)

nb_param_pln

number of parameters in the PLN part of the current model

vcov_model

character: the model used for the residual covariance

pen_loglik

variational lower bound of the l1-penalized loglikelihood

ebic_gamma

the tuning parameter gamma of the EBIC, between 0 and 1. Zero gives back the BIC; the default 0.5 is the value recommended by Foygel and Drton (2010). Assign to it to change the EBIC of this fit.

EBIC

variational lower bound of the EBIC of Foygel and Drton (2010), that is the BIC with the additional penalty 2 gamma |E| log(p) on the edge set

density

proportion of non-null edges in the network

criteria

a vector with loglik, penalized loglik, BIC, EBIC, ICL, R_squared, number of parameters, number of edges and graph density

Methods

Inherited methods


ZIPLNfit_sparse$new()

Initialize a ZIPLNfit_fixed model

Usage

ZIPLNfit_sparse$new(data, control)

Arguments

data

a named list used internally to carry the data matrices

control

a list for controlling the optimization. See details.


ZIPLNfit_sparse$optimize()

Call to the optimizer and update of the relevant fields. Reports non-convergence of the graphical Lasso on top of ZIPLNfit's method.

Usage

ZIPLNfit_sparse$optimize(data, control)

Arguments

data

a named list used internally to carry the data matrices

control

a list for controlling the optimization. See details.


ZIPLNfit_sparse$latent_network()

Extract interaction network in the latent space

Usage

ZIPLNfit_sparse$latent_network(type = c("partial_cor", "support", "precision"))

Arguments

type

edge value in the network. Can be "support" (binary edges), "precision" (coefficient of the precision matrix) or "partial_cor" (partial correlation between species)

Returns

a square matrix of size ZIPLNfit_sparse$n


ZIPLNfit_sparse$plot_network()

plot the latent network.

Usage

ZIPLNfit_sparse$plot_network(
  type = c("partial_cor", "support"),
  output = c("igraph", "corrplot"),
  edge.color = c("#F8766D", "#00BFC4"),
  remove.isolated = FALSE,
  node.labels = NULL,
  layout = layout_in_circle,
  edge.alpha = 0.2,
  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.

edge.alpha

opacity of the weakest edge, the strongest one being fully opaque, so that the strength of an edge can be read off a dense network. Default is 0.2. Set it to 1 for uniformly opaque edges. Only relevant for igraph output with type = "partial_cor".

plot

logical. Should the final network be displayed or only sent back to the user. Default is TRUE.


ZIPLNfit_sparse$clone()

The objects of this class are cloneable with this method.

Usage

ZIPLNfit_sparse$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

if (FALSE) { # \dontrun{
# See other examples in function ZIPLN
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
myPLN <- ZIPLN(Abundance ~ 1, data = trichoptera, control=  ZIPLN_param(penalty = 1))
class(myPLN)
print(myPLN)
plot(myPLN)
} # }