Collects the fine-grained knobs for the sequential synthesis engine. Strong
defaults mean beginners can ignore this; power users can tune the
utility / privacy / speed trade-off. Returns a validated synth_control
object consumed by synth() and synth_linked().
Usage
synth_control(
visit_sequence = NULL,
predictor_matrix = NULL,
method = NULL,
smoothing = NULL,
proper = FALSE,
count_model = c("marginal", "conditional"),
k = NULL,
cart = list(),
forest = list(),
constraint_max_tries = 50L,
temporal = temporal_control(),
parallel = FALSE
)Arguments
- visit_sequence
Optional character vector giving the order in which variables are synthesised.
NULLuses the natural (left-to-right) order.- predictor_matrix
Optional 0/1 matrix marking, for each variable, which variables may predict it (including cross-table predictors).
NULLlets the engine derive a sensible default.- method
Optional per-variable method override; a single string applies globally.
NULLuses the call-levelmethod.- smoothing
Numeric-variable kernel smoothing.
NULL(default) is auto: smooth numeric variables that look continuous (more than 20 distinct values), so their draws are not confined to the observed values – improving marginal realism and reducing exact-value replication.TRUE/"density"smooths every numeric variable;FALSE/"none"disables smoothing; a character vector smooths exactly the named variables. Auto resolution applies to single-tablesynth();synth_linked()children are unsmoothed unless named explicitly.- proper
Logical; use proper (
TRUE) vs improper (FALSE) synthesis.- count_model
How the number of rows per unit is drawn for nested / longitudinal data.
"marginal"(default) resamples the observed unit sizes independently of any covariate."conditional"synthesises the subject-level covariates first and draws each unit's size from a CART model of size on those covariates, so a dependence such as "sicker patients have more visits" is preserved. Only takes effect when the structure is nested and there are subject-level covariates; ignored for flat single-row-per-unit data.- k
Optional size of each synthetic dataset.
NULLmatches the input.- cart, forest
Named lists of hyperparameters passed to the CART / random forest backends. For
forest,ntree(number of trees, default 10) andmtry(predictors tried per tree, default all) are recognised.- constraint_max_tries
Integer; how many times
synth()may regenerate while rejection-sampling to satisfyconstraints. Defaults to 50.- temporal
A
temporal_control()object (or"auto","codec_only","off") governing nativeDate,POSIXct,POSIXlt,difftime, andhmssynthesis. Defaults totemporal_control().- parallel
Controls parallel generation of the
msynthetic replicates.FALSE(default) synthesises serially.TRUEuses all available workers (getOption("mc.cores"), elseparallel::detectCores()); a positive integer sets an explicit worker count. Parallelism spreads the independent replicates over a cluster, so it only helps whenm > 1. A parallel run is reproducible for a fixed (seed, worker count) via independent L'Ecuyer RNG streams, but its output differs from a serial run with the same seed.
Examples
ctrl <- synth_control(proper = TRUE, cart = list(minbucket = 5))
ctrl
#> <synth_control>
#> proper : TRUE
#> count_model : marginal
#> k : match input
#> method : call-level
#> smoothing : none
#> predictor_matrix : default
#> cart params : 1
#> forest params : 0
#> constraint tries : 50
#> parallel : serial