simulate_tna_network: Simulate a grouped TNA transition network

View source: R/tna.R

simulate_tna_networkR Documentation

Simulate a grouped TNA transition network

Description

Simulate a grouped TNA transition network

Usage

simulate_tna_network(
  groups,
  nodes_per_group,
  group_names = NULL,
  within_probability = 0.4,
  between_probability = 0.15,
  loops = FALSE,
  seed = NULL,
  batch = NULL
)

Arguments

groups

Number of node groups.

nodes_per_group

Nodes per group, scalar or vector.

group_names

Optional group names.

within_probability, between_probability

Edge probabilities within and between node groups.

loops

Permit self transitions when drawing the underlying edges. A node left with no outgoing edge is nevertheless given a self transition of probability one, so self-loops can appear even when loops is FALSE.

seed

Optional random seed.

batch

Optional single positive whole number. When given, the simulator runs batch times and returns a plain list of batch results, each exactly what the same call without batch returns. With a seed, every dataset gets its own seed drawn from seed, so the whole batch is reproducible; without one the datasets are consecutive draws from the session's random-number stream. The default NULL returns a single result.

Value

A tidy simulab_sim base data.frame holding the non-zero transitions only, one row per edge, with columns from, to, and probability. as.data.frame(x, what = ) also returns nodes (node, group), adjacency (the long row/column/weight table of the underlying directed Bernoulli graph), and transitions (the full nodes^2-row transition table including zeros). The transition matrix is row-stochastic: every from node's probabilities sum to one.

Examples

result <- simulate_tna_network(groups = 3, nodes_per_group = 4, seed = 1)
head(result)
components(result)

simulab documentation built on Oct. 15, 2026, 5:08 p.m.