View source: R/network_formats.R
| simulate_temporal_network | R Documentation |
Simulate a temporal network as edge-activity spells
simulate_temporal_network(
nodes,
periods,
initial_probability = 0.1,
formation_probability = 0.05,
dissolution_probability = 0.1,
directed = TRUE,
loops = FALSE,
weight = c("binary", "uniform", "normal", "poisson"),
weight_mean = 1,
weight_sd = 1,
weight_range = c(0.1, 1),
node_type = NULL,
seed = NULL,
batch = NULL
)
nodes |
Number of nodes or unique node labels. |
periods |
Number of discrete observation periods. |
initial_probability |
Probability that a dyad is active initially. |
formation_probability |
Probability that an inactive dyad forms at the next period. |
dissolution_probability |
Probability that an active dyad dissolves at the next period. |
directed |
Generate directed dyads. |
loops |
Permit self-loops. |
weight |
Edge-spell weight distribution. One weight is drawn per spell and held constant while the spell is active. |
weight_mean, weight_sd, weight_range |
Weight parameters. |
node_type |
Optional node type for each node. |
seed |
Optional seed. |
batch |
Optional single positive whole number. When given, the
simulator runs |
A tidy spell-level simulab_sim base data.frame with one row per
activity spell and columns from, to, onset, terminus, weight,
and censored. terminus is exclusive: the spell covers periods onset
through terminus - 1, so a spell still active in the final period has
terminus == periods + 1 and censored == TRUE.
as.data.frame(x, what = ) also returns events (from, to, time,
event – "formation" or "dissolution" – and weight, ordered by
time), snapshots (one row per active dyad per period: period, from,
to, weight), nodes (node, type), and a one-row settings table.
result <- simulate_temporal_network(
nodes = 20, periods = 4, initial_probability = 0.1, seed = 1
)
head(result)
components(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.