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.
PLNmodels::PLNfit -> PLNnetworkfit
penaltythe level of sparsity in the current model
n_edgesnumber of edges if the network (non null coefficient of the sparse precision matrix)
nb_paramnumber of parameters in the current PLN model
pen_loglikvariational lower bound of the l1-penalized loglikelihood
model_para list with the matrices associated with the estimated parameters of the pPCA model: Theta (covariates), Sigma (latent covariance) and Theta (latent precision matrix). Note Omega and Sigma are inverse of each other.
EBICvariational lower bound of the EBIC
densityproportion of non-null edges in the network
criteriaa 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,
responses,
covariates,
offsets,
weights,
formula,
xlevels,
control
)penaltya positive real number controlling the level of sparsity of the underlying network.
responsesthe matrix of responses common to every models
covariatesthe matrix of covariates common to every models
offsetsthe matrix of offsets common to every models
weightsan optional vector of observation weights to be used in the fitting process.
formulamodel formula used for fitting, extracted from the formula in the upper-level call
xlevelsnamed listed of factor levels included in the models, extracted from the formula in PLNnetwork() call
controla list for controlling the optimization of the PLN model used at initialization. See PLNnetwork() for details.
update()Update fields of a PLNnetworkfit object
PLNnetworkfit$update(
penalty = NA,
Theta = NA,
Sigma = NA,
Omega = NA,
M = NA,
S2 = NA,
Z = NA,
A = NA,
Ji = NA,
R2 = NA,
monitoring = NA
)penaltya positive real number controlling the level of sparsity of the underlying network.
Thetamatrix of regression matrix
Sigmavariance-covariance matrix of the latent variables
Omegaprecision matrix of the latent variables. Inverse of Sigma.
Mmatrix of mean vectors for the variational approximation
S2matrix of variance vectors for the variational approximation
Zmatrix of latent vectors (includes covariates and offset effects)
Amatrix of fitted values
Jivector of variational lower bounds of the log-likelihoods (one value per sample)
R2approximate R^2 goodness-of-fit criterion
monitoringa list with optimization monitoring quantities
optimize()Call to the C++ optimizer and update of the relevant fields
PLNnetworkfit$optimize(responses, covariates, offsets, weights, control)responsesthe matrix of responses common to every models
covariatesthe matrix of covariates common to every models
offsetsthe matrix of offsets common to every models
weightsan optional vector of observation weights to be used in the fitting process.
controla list for controlling the optimization of the PLN model used at initialization. See PLNnetwork() for details.
postTreatment()Compute PCA scores in the latent space and update corresponding fields.
PLNnetworkfit$postTreatment(responses, covariates, offsets, weights, nullModel)responsesthe matrix of responses common to every models
covariatesthe matrix of covariates common to every models
offsetsthe matrix of offsets common to every models
weightsan optional vector of observation weights to be used in the fitting process.
nullModelnull model used for approximate R2 computations. Defaults to a GLM model with same design matrix but not latent variable.
latent_network()Extract interaction network in the latent space
PLNnetworkfit$latent_network(type = c("partial_cor", "support", "precision"))typeedge value in the network. Can be "support" (binary edges), "precision" (coefficient of the precision matrix) or "partial_cor" (partial correlation between species)
a square matrix of size PLNnetworkfit$n
plot_network()plot the latent network.
PLNnetworkfit$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,
plot = TRUE
)typeedge value in the network. Either "precision" (coefficient of the precision matrix) or "partial_cor" (partial correlation between species).
outputOutput type. Either igraph (for the network) or corrplot (for the adjacency matrix)
edge.colorLength 2 color vector. Color for positive/negative edges. Default is c("#F8766D", "#00BFC4"). Only relevant for igraph output.
remove.isolatedif TRUE, isolated node are remove before plotting. Only relevant for igraph output.
node.labelsvector of character. The labels of the nodes. The default will use the column names ot the response matrix.
layoutan optional igraph layout. Only relevant for igraph output.
plotlogical. Should the final network be displayed or only sent back to the user. Default is TRUE.
show()User friendly print method
PLNnetworkfit$show()
clone()The objects of this class are cloneable with this method.
PLNnetworkfit$clone(deep = FALSE)deepWhether to make a deep clone.
The function PLNnetwork(), the class PLNnetworkfamily
if (FALSE) {
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
nets <- PLNnetwork(Abundance ~ 1, data = trichoptera)
myPLNnet <- getBestModel(nets)
class(myPLNnet)
print(myPLNnet)
}
Run the code above in your browser using DataLab