`R/PLNnetworkfit-class.R`

`PLNnetworkfit.Rd`

The function `PLNnetwork()`

produces a collection of models which are instances of object with class `PLNnetworkfit`

.
This class comes with a set of methods, some of them being useful for the user:
See the documentation for `plot()`

and methods inherited from `PLNfit`

.

The function `PLNnetwork()`

, the class `PLNnetworkfamily`

`PLNmodels::PLNfit`

-> `PLNmodels::PLNfit_fixedcov`

-> `PLNnetworkfit`

`vcov_model`

character: the model used for the residual covariance

`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`

number of parameters in the current PLN model

`pen_loglik`

variational lower bound of the l1-penalized loglikelihood

`EBIC`

variational lower bound of the EBIC

`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

`new()`

Initialize a `PLNnetworkfit`

object

```
PLNnetworkfit$new(
penalty,
penalty_weights,
responses,
covariates,
offsets,
weights,
formula,
control
)
```

`penalty`

a positive real number controlling the level of sparsity of the underlying network.

`penalty_weights`

either a single or a list of p x p matrix of weights (default filled with 1) to adapt the amount of shrinkage to each pairs of node. Must be symmetric with positive values.

`responses`

the matrix of responses (called Y in the model). Will usually be extracted from the corresponding field in PLNfamily-class

`covariates`

design matrix (called X in the model). Will usually be extracted from the corresponding field in PLNfamily-class

`offsets`

offset matrix (called O in the model). Will usually be extracted from the corresponding field in PLNfamily-class

`weights`

an optional vector of observation weights to be used in the fitting process.

`formula`

model formula used for fitting, extracted from the formula in the upper-level call

`control`

a list for controlling the optimization.

`update()`

Update fields of a `PLNnetworkfit`

object

```
PLNnetworkfit$update(
penalty = NA,
B = NA,
Sigma = NA,
Omega = NA,
M = NA,
S = NA,
Z = NA,
A = NA,
Ji = NA,
R2 = NA,
monitoring = NA
)
```

`penalty`

a positive real number controlling the level of sparsity of the underlying network.

`B`

matrix of regression matrix

`Sigma`

variance-covariance matrix of the latent variables

`Omega`

precision matrix of the latent variables. Inverse of Sigma.

`M`

matrix of mean vectors for the variational approximation

`S`

matrix of variance vectors for the variational approximation

`Z`

matrix of latent vectors (includes covariates and offset effects)

`A`

matrix of fitted values

`Ji`

vector of variational lower bounds of the log-likelihoods (one value per sample)

`R2`

approximate R^2 goodness-of-fit criterion

`monitoring`

a list with optimization monitoring quantities

`optimize()`

Call to the C++ optimizer and update of the relevant fields

`responses`

the matrix of responses (called Y in the model). Will usually be extracted from the corresponding field in PLNfamily-class

`covariates`

design matrix (called X in the model). Will usually be extracted from the corresponding field in PLNfamily-class

`offsets`

offset matrix (called O in the model). Will usually be extracted from the corresponding field in PLNfamily-class

`weights`

an optional vector of observation weights to be used in the fitting process.

`config`

a list for controlling the optimization

`latent_network()`

Extract interaction network in the latent space

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

`plot_network()`

plot the latent network.

`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`

.

```
if (FALSE) {
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
nets <- PLNnetwork(Abundance ~ 1, data = trichoptera)
myPLNnet <- getBestModel(nets)
class(myPLNnet)
print(myPLNnet)
}
```