gen_partial_correlations {SeqNet} | R Documentation |
Generate partial correlations for a list of networks.
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
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. |
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
Grimes T, Datta S (2021). “SeqNet: An R Package for Generating Gene-Gene Networks and Simulating RNA-Seq Data.” Journal of Statistical Software, 98(12), 1–49. doi: 10.18637/jss.v098.i12, https://doi.org/10.18637/jss.v098.i12.
Examples
nw <- random_network(10) # Create a random network with 10 nodes.
nw <- gen_partial_correlations(nw) # Add weights to connections in the network.