Construct a fully-functional group_tna object from synthetic parameters.
Each group receives its own randomly drawn transition matrix and initial
probabilities over a shared alphabet, so groups have heterogeneous
dynamics by default. Per-group overrides allow custom group sizes,
sparsity, stickiness, or hand-supplied transition matrices.
Usage
random_group_tna(
n_groups = NULL,
group_names = NULL,
n_states = NULL,
states = NULL,
category = NULL,
alpha = NULL,
diag_boost = NULL,
n_sequences = NULL,
seq_length = NULL,
type = "relative",
per_group = NULL,
seed = NULL
)Arguments
- n_groups
An
integergiving the number of groups. IfNULL(the default), a value is drawn from2:4on each call.- group_names
An optional
charactervector of group names of lengthn_groups. Defaults to"Group 1","Group 2", ...- n_states
An
integer>= 2 giving the number of states. IfNULL(the default), a value is drawn from7:11on each call.- states
An optional
charactervector of state labels of length at leastn_states. The firstn_statesare used. IfNULL(the default), labels are taken fromcategoryor auto-picked from a built-in pool that fitsn_states.- category
An optional
characterstring naming a built-in label pool. Available pools are returned bylist_random_state_pools(). WhenNULL(the default), a pool whose size is at leastn_statesis sampled at random. Ignored whenstatesis supplied.- alpha
A positive
numericDirichlet concentration parameter. Small values (e.g.0.3) produce sparse, peaked transitions; large values (e.g.5) produce near-uniform transitions. IfNULL(the default), a value is drawn fromUniform(0.5, 1.0)on each call.- diag_boost
A non-negative
numericadded to the diagonal of the transition matrix before re-normalising rows. Larger values make states "stickier" (more self-transitions). IfNULL(the default), a value is drawn fromUniform(1.5, 3.0)on each call.- n_sequences
An
integergiving the number of sequences to simulate from the true parameters. IfNULL(the default), a value is drawn from500:800on each call.- seq_length
An
integergiving the length of each simulated sequence. IfNULL(the default), a value is drawn from6:20on each call.- type
A
characterstring giving the model type. One of"relative"(the default),"frequency","co-occurrence","attention".- per_group
An optional
listof lengthn_groups. Each element is itself alistof overrides applied to that group only. Recognised override names:alpha,diag_boost,trans_matrix,init_probs,n_sequences,seq_length. Unset entries fall back to the top-level defaults (which may themselves be drawn at random whenNULL).- seed
An
integerrandom seed for reproducibility, orNULL(the default) for fresh randomness on every call.
Examples
# Fresh random group model on every call
model <- random_group_tna()
# Explicit two-group engagement demo with per-group differences
model <- random_group_tna(
n_groups = 2,
n_states = 3,
category = "engagement",
per_group = list(
list(n_sequences = 400, diag_boost = 3),
list(n_sequences = 100, alpha = 0.3)
),
seed = 42
)
