Assign i.i.d. signed weights on a binary undirected adjacency
Source:R/02_02_generate_synthetic_networks.R
assign_iid_signed_weights.RdFor each undirected edge, draws an inhibitory versus activatory sign
and a common magnitude. By convention a positive precision
off-diagonal is an inhibitory partial correlation
(\(\rho_{jk\mid -\{j,k\}}=-\Omega_{jk}/
\sqrt{\Omega_{jj}\Omega_{kk}}\)). Thus
prop_inhibitory is the target fraction of edges with
\(\Omega_{jk}>0\) (negative partial correlation). The complementary
fraction is activatory (\(\Omega_{jk}<0\)).
Examples
A <- generate_random_network_skeleton(6L, "hub")
assign_iid_signed_weights(A, prop_inhibitory = 0.5)
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 0.0 0.3 -0.3 0.0 0.0 0.0
#> [2,] 0.3 0.0 0.0 0.0 0.0 0.0
#> [3,] -0.3 0.0 0.0 0.0 0.0 0.0
#> [4,] 0.0 0.0 0.0 0.0 0.3 -0.3
#> [5,] 0.0 0.0 0.0 0.3 0.0 0.0
#> [6,] 0.0 0.0 0.0 -0.3 0.0 0.0