`R/PLNnetworkfamily-S3methods.R`

`extract_probs.Rd`

Extracts edge selection frequency in networks reconstructed from bootstrap subsamples during the stars stability selection procedure, as either a matrix or a named vector. In the latter case, edge names follow igraph naming convention.

- Robject
an object with class

`PLNnetworkfamily`

, i.e. an output from`PLNnetwork()`

- penalty
penalty used for the bootstrap subsamples

- index
Integer index of the model to be returned. Only the first value is taken into account.

- crit
a character for the criterion used to performed the selection. Either "BIC", "ICL", "EBIC", "StARS", "R_squared". Default is

`ICL`

for`PLNPCA`

, and`BIC`

for`PLNnetwork`

. If StARS (Stability Approach to Regularization Selection) is chosen and stability selection was not yet performed, the function will call the method`stability_selection()`

with default argument.- format
output format. Either a matrix (default) or a named vector.

- tol
tolerance for rounding error when comparing penalties.

Either a matrix or named vector of edge-wise probabilities. In the latter case, edge names follow igraph convention.

```
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
nets <- PLNnetwork(Abundance ~ 1 + offset(log(Offset)), data = trichoptera)
#>
#> Initialization...
#> Adjusting 30 PLN with sparse inverse covariance estimation
#> Joint optimization alternating gradient descent and graphical-lasso
#> sparsifying penalty = 3.65921
sparsifying penalty = 3.379906
sparsifying penalty = 3.121921
sparsifying penalty = 2.883627
sparsifying penalty = 2.663522
sparsifying penalty = 2.460218
sparsifying penalty = 2.272432
sparsifying penalty = 2.098979
sparsifying penalty = 1.938766
sparsifying penalty = 1.790781
sparsifying penalty = 1.654092
sparsifying penalty = 1.527837
sparsifying penalty = 1.411218
sparsifying penalty = 1.303501
sparsifying penalty = 1.204006
sparsifying penalty = 1.112105
sparsifying penalty = 1.027219
sparsifying penalty = 0.9488126
sparsifying penalty = 0.8763906
sparsifying penalty = 0.8094964
sparsifying penalty = 0.7477083
sparsifying penalty = 0.6906363
sparsifying penalty = 0.6379207
sparsifying penalty = 0.5892287
sparsifying penalty = 0.5442534
sparsifying penalty = 0.502711
sparsifying penalty = 0.4643395
sparsifying penalty = 0.4288969
sparsifying penalty = 0.3961595
sparsifying penalty = 0.365921
#> Post-treatments
#> DONE!
if (FALSE) {
stability_selection(nets)
probs <- extract_probs(nets, crit = "StARS", format = "vector")
probs
}
if (FALSE) {
## Add edge attributes to graph using igraph
net_stars <- getBestModel(nets, "StARS")
g <- plot(net_stars, type = "partial_cor", plot=F)
library(igraph)
E(g)$prob <- probs[as_ids(E(g))]
g
}
```