R/relative_association_functions.R
simulate_sticky_association_network.Rd
Used for testing properties of algorithms. Will create an association network that is constructed where some nodes are more "sticky" than others. Or they are in general more associated than others.
simulate_sticky_association_network( n_variables = 50, n_clusters = 4, cluster_coherence = 2, stickiness_dist = function(n) { stats::rbeta(n, shape1 = 1, shape2 = 4) }, association_dist = function(n) { stats::rbeta(n, shape1 = 0.5, shape2 = 10) } )
n_variables | How many variables will be simulated |
---|---|
n_clusters | Controls how many clusters are randomly assigned to nodes |
cluster_coherence | Scalar that multiplies random association value for
nodes in the same clusters. E.g. A value of |
stickiness_dist | Function that takes a single input: |
association_dist | Function of same format as |
List with variables
with info about each variable (id
,
stickiness
scalar, and cluster
id) and associations
which contains
the simulated associations in the format that works for all the functions
that take association_pairs
as an input.
# Simulate an association network with flat stickiness profile simulate_sticky_association_network( n_variables = 10, n_clusters = 3, cluster_coherence = 2, stickiness_dist = function(n) {runif(n)}, association_dist = function(n) {rbeta(n, shape1 = 1, shape2 = 10)} )#> $variables #> # A tibble: 10 x 3 #> id stickiness cluster #> <int> <dbl> <int> #> 1 1 0.0913 1 #> 2 2 0.854 3 #> 3 3 1.07 3 #> 4 4 0.521 1 #> 5 5 1.08 2 #> 6 6 0.170 3 #> 7 7 1.04 3 #> 8 8 2.60 3 #> 9 9 0.773 2 #> 10 10 1.81 1 #> #> $associations#> Error: Input must be a vector, not NULL.