| simulate_dynamics | R Documentation |
Generates synthetic lineage frequency data under a multinomial sampling model with configurable growth advantages. Useful for model validation, power analysis, and teaching.
simulate_dynamics(
n_lineages = 4L,
n_timepoints = 20L,
total_per_tp = 500L,
advantages = NULL,
reference_name = "ref",
start_date = Sys.Date(),
interval = 7L,
overdispersion = NULL,
seed = NULL
)
n_lineages |
Number of lineages including reference. Default 4. |
n_timepoints |
Number of time points. Default 20. |
total_per_tp |
Sequences per time point. A single integer
(constant across time) or a vector of length |
advantages |
Named numeric vector of per-week multiplicative
growth advantages for non-reference lineages. Length must equal
|
reference_name |
Name of the reference lineage. Default |
start_date |
Start date for the time series. Default today. |
interval |
Days between consecutive time points. Default 7 (weekly data). |
overdispersion |
If |
seed |
Random seed for reproducibility. |
An lfq_data object with an additional true_freq column
containing the true (pre-sampling) frequencies.
# JN.1 grows 1.3x per week, KP.3 declines at 0.9x
sim <- simulate_dynamics(
n_lineages = 3,
advantages = c("JN.1" = 1.3, "KP.3" = 0.9),
n_timepoints = 15,
seed = 42
)
sim
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.