`R/PLNnetworkfamily-class.R`

`PLNnetworkfamily.Rd`

The function `PLNnetwork()`

produces an instance of this class.

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

,
`getModel()`

and plot()

The function `PLNnetwork()`

, the class `PLNnetworkfit`

`PLNmodels::PLNfamily`

-> `PLNnetworkfamily`

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

`new()`

Initialize all models in the collection

```
PLNnetworkfamily$new(
penalties,
responses,
covariates,
offsets,
weights,
formula,
control
)
```

`penalties`

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

`responses`

the matrix of responses common to every models

`covariates`

the matrix of covariates common to every models

`offsets`

the matrix of offsets common to every models

`weights`

the vector of observation weights

`formula`

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

`control`

a list for controlling the optimization.

Update current `PLNnetworkfit`

with smart starting values

`optimize()`

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

`stability_selection()`

Compute the stability path by stability selection

```
PLNnetworkfamily$stability_selection(
subsamples = NULL,
control = PLNnetwork_param()
)
```

`subsamples`

a list of vectors describing the subsamples. The number of vectors (or list length) determines the number of subsamples used in the stability selection. Automatically set to 20 subsamples with size

`10*sqrt(n)`

if`n >= 144`

and`0.8*n`

otherwise following Liu et al. (2010) recommendations.`control`

a list controlling the main optimization process in each call to PLNnetwork. See

`PLNnetwork()`

for details.

`coefficient_path()`

Extract the regularization path of a `PLNnetworkfamily`

`getBestModel()`

Extract the best network in the family according to some criteria

```
PLNnetworkfamily$getBestModel(
crit = c("BIC", "EBIC", "StARS"),
stability = 0.9
)
```

`plot()`

Display various outputs (goodness-of-fit criteria, robustness, diagnostic) associated with a collection of PLNnetwork fits (a `PLNnetworkfamily`

)

```
PLNnetworkfamily$plot(
criteria = c("loglik", "pen_loglik", "BIC", "EBIC"),
reverse = FALSE,
log.x = TRUE
)
```

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

.

`plot_stars()`

Plot stability path

```
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
fits <- PLNnetwork(Abundance ~ 1, data = trichoptera)
#>
#> Initialization...
#> Adjusting 30 PLN with sparse inverse covariance estimation
#> Joint optimization alternating gradient descent and graphical-lasso
#> sparsifying penalty = 7.541317
sparsifying penalty = 6.965695
sparsifying penalty = 6.43401
sparsifying penalty = 5.942907
sparsifying penalty = 5.48929
sparsifying penalty = 5.070297
sparsifying penalty = 4.683286
sparsifying penalty = 4.325815
sparsifying penalty = 3.995629
sparsifying penalty = 3.690646
sparsifying penalty = 3.408942
sparsifying penalty = 3.148741
sparsifying penalty = 2.9084
sparsifying penalty = 2.686404
sparsifying penalty = 2.481353
sparsifying penalty = 2.291954
sparsifying penalty = 2.117011
sparsifying penalty = 1.955421
sparsifying penalty = 1.806166
sparsifying penalty = 1.668303
sparsifying penalty = 1.540962
sparsifying penalty = 1.423342
sparsifying penalty = 1.3147
sparsifying penalty = 1.21435
sparsifying penalty = 1.121659
sparsifying penalty = 1.036044
sparsifying penalty = 0.9569638
sparsifying penalty = 0.8839195
sparsifying penalty = 0.8164507
sparsifying penalty = 0.7541317
#> Post-treatments
#> DONE!
class(fits)
#> [1] "PLNnetworkfamily" "PLNfamily" "R6"
```