
Simulate Synthetic Section Data From a Schema Mapping
Source:R/simulate_cohort.R
simulate_section_data.RdGenerates synthetic data honoring the column roles declared in a validated mapping table.
If the pslongSim package is available, it is leveraged for baseline subject scaffolding;
otherwise, an internal robust generator produces demographic and longitudinal grids.
Usage
simulate_section_data(
mapping,
index,
n_subjects = 20,
seed = 1,
missing_rate = 0,
time_levels = NULL
)Arguments
- mapping
Validated column mapping table; see
validate_column_mapping.- index
Character string identifying the section/domain in
mapping$INDEXto simulate.- n_subjects
Number of synthetic subjects to generate (default: 20).
- seed
Random seed for reproducibility (default: 1).
- missing_rate
Probability in
[0, 1]that any non-ID, non-time cell is set to NA.- time_levels
Optional character vector of levels for the section's
Time_varcolumn (default:c("T0", "T1", "T2", "T3")).