Networkfamily: An R6 Class to virtually represent a collection of network...

NetworkfamilyR Documentation

An R6 Class to virtually represent a collection of network fits

Description

The functions PLNnetwork() and ZIPLNnetwork() both produce an instance of this class, which can be thought of as a vector of PLNnetworkfits ZIPLNfit_sparses (indexed by penalty parameter)

This class comes with a set of methods mostly used to compare network fits (in terms of goodness of fit) or extract one from the family (based on penalty parameter and/or goodness of it). See the documentation for getBestModel(), getModel() and plot() for the user-facing ones.

Super class

PLNmodels::PLNfamily -> Networkfamily

Active bindings

penalties

the sparsity level of the network in the successively fitted models

stability_path

the stability path of each edge as returned by the stars procedure

stability

mean edge stability along the penalty path

criteria

a data frame with the values of some criteria (variational log-likelihood, (E)BIC, ICL and R2, stability) for the collection of models / fits BIC, ICL and EBIC are defined so that they are on the same scale as the model log-likelihood, i.e. with the form, loglik - 0.5 penalty

Methods

Public methods

Inherited methods

Method new()

Initialize all models in the collection

Usage
Networkfamily$new(penalties, data, control)
Arguments
penalties

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

data

a named list used internally to carry the data matrices

control

a list for controlling the optimization.

Returns

Update all network fits in the family with smart starting values


Method optimize()

Call to the C++ optimizer on all models of the collection

Usage
Networkfamily$optimize(data, config)
Arguments
data

a named list used internally to carry the data matrices

config

a list for controlling the optimization.


Method coefficient_path()

Extract the regularization path of a Networkfamily

Usage
Networkfamily$coefficient_path(precision = TRUE, corr = TRUE)
Arguments
precision

Logical. Should the regularization path be extracted from the precision matrix Omega (TRUE, default) or from the variance matrix Sigma (FALSE)

corr

Logical. Should the matrix be transformed to (partial) correlation matrix before extraction? Defaults to TRUE


Method getBestModel()

Extract the best network in the family according to some criteria

Usage
Networkfamily$getBestModel(crit = c("BIC", "EBIC", "StARS"), stability = 0.9)
Arguments
crit

character. Criterion used to perform the selection. If "StARS" is chosen but ⁠$stability⁠ field is empty, will compute stability path.

stability

Only used for "StARS" criterion. A scalar indicating the target stability (= 1 - 2 beta) at which the network is selected. Default is 0.9.

Details

For BIC and EBIC criteria, higher is better.


Method plot()

Display various outputs (goodness-of-fit criteria, robustness, diagnostic) associated with a collection of network fits (a Networkfamily)

Usage
Networkfamily$plot(
  criteria = c("loglik", "pen_loglik", "BIC", "EBIC"),
  reverse = FALSE,
  log.x = TRUE
)
Arguments
criteria

vector of characters. The criteria to plot in c("loglik", "pen_loglik", "BIC", "EBIC"). Defaults to all of them.

reverse

A logical indicating whether to plot the value of the criteria in the "natural" direction (loglik - 0.5 penalty) or in the "reverse" direction (-2 loglik + penalty). Default to FALSE, i.e use the natural direction, on the same scale as the log-likelihood.

log.x

logical: should the x-axis be represented in log-scale? Default is TRUE.

Returns

a ggplot graph


Method plot_stars()

Plot stability path

Usage
Networkfamily$plot_stars(stability = 0.9, log.x = TRUE)
Arguments
stability

scalar: the targeted level of stability using stability selection. Default is 0.9.

log.x

logical: should the x-axis be represented in log-scale? Default is TRUE.

Returns

a ggplot graph


Method plot_objective()

Plot objective value of the optimization problem along the penalty path

Usage
Networkfamily$plot_objective()
Returns

a ggplot graph


Method show()

User friendly print method

Usage
Networkfamily$show()

Method clone()

The objects of this class are cloneable with this method.

Usage
Networkfamily$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

The functions PLNnetwork(), ZIPLNnetwork() and the classes PLNnetworkfit, ZIPLNfit_sparse


PLN-team/PLNmodels documentation built on Oct. 13, 2024, 4:01 a.m.