gen_partial_correlations: Generate partial correlations for a list of networks.

Description Usage Arguments Value References Examples

View source: R/ggm.R

Description

Random partial correlations are generated to weigh the network connections. If multiple networks are provided, the networks must contain the same nodes and the same modules (the connections within modules may differ). Any connection that is common across different networks will also have the same partial correlation weight across networks.

Usage

1
2
3
4
5
gen_partial_correlations(
  ...,
  k = 2.5,
  rweights = function(n) (-1)^rbinom(n, 1, 0.5) * runif(n, 0.5, 1)
)

Arguments

...

The 'network' objects to modify.

k

An positive number used to ensure that the matrix inverse is numerically stable. k = 2.5 is the default value; higher values will allow for larger values of partial correlations (and will result in a wider distribution of Pearson correlations).

rweights

A generator for initial weights in the network. By default, values are generated uniformly from (-1, -0.5) U (0.5, 1). The weights will be adjusted so that the sign of a generated weight and the sign of the corresponding partial correlation agree.

Value

An updated network object containing random weights. If multiple networks were provided, then a list of network objects is returned.

References

\insertRef

grimes21SeqNet

Examples

1
2
nw <- random_network(10) # Create a random network with 10 nodes.
nw <- gen_partial_correlations(nw) # Add weights to connections in the network.

SeqNet documentation built on July 9, 2021, 9:08 a.m.