View source: R/network_formats.R
| simulate_network_matrix | R Documentation |
Simulate a network matrix
simulate_network_matrix(
nodes,
type = c("adjacency", "transition", "frequency", "cooccurrence"),
probability = 0.2,
directed = TRUE,
loops = FALSE,
weighted = TRUE,
weight_range = c(0.1, 1),
frequency_mean = 10,
seed = NULL,
batch = NULL
)
nodes |
Number of nodes or unique node labels. |
type |
Matrix type. |
probability |
Probability of a non-zero dyad. |
directed |
Generate an asymmetric matrix where applicable. |
loops |
Permit non-zero diagonal entries. |
weighted |
Generate weighted adjacency/co-occurrence values. Ignored by
the |
weight_range |
Range for continuous weights. |
frequency_mean |
Mean positive count for frequency matrices; drawn as
|
seed |
Optional seed. |
batch |
Optional single positive whole number. When given, the
simulator runs |
A tidy simulab_sim base data.frame holding the complete matrix in
long form: nodes^2 rows with columns from, to, and value, zeros
included. as.data.frame(x, what = ) also returns edges (the non-zero
rows only), nodes (node), matrix (the wide form: a from column
followed by one column per node), and a one-row settings table whose
directed field reports whether the generated matrix is asymmetric.
The transition type is row-stochastic: every from state's value
entries sum to one.
result <- simulate_network_matrix(nodes = 8, type = "adjacency", seed = 1)
head(result)
components(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.