Opt into differentially private synthesis. Passing the result as
synth(..., privacy = dp_control(...)) selects the DP synthesiser and yields
a formal (\(\epsilon\), \(\delta\)) guarantee. The privacy unit is
person-level by default: the guarantee protects a whole individual (all of
their rows), enforced by bounding each person's contribution before any budget
is spent.
Usage
dp_control(
epsilon,
delta = 0,
unit = c("person", "row"),
max_rows_per_person = NULL,
mechanism = c("laplace", "gaussian"),
dependence = c("tree", "independent"),
structure_frac = NULL,
degree = 1L,
select = c("fixed", "adaptive", "aim"),
treewidth = 1L,
select_frac = 0.25,
anneal = FALSE,
estimator = c("local", "pgm"),
scoring = c("auto", "independence", "model"),
cross_table = FALSE,
longitudinal = FALSE,
baseline = NULL,
transition_order = 1L,
transition_cross = 0L,
transition_parent = 0L,
bins = 12L,
bounds = NULL,
domain = c("dp", "public", "data"),
domain_frac = 0.1
)Arguments
- epsilon
Positive privacy-loss budget. Smaller = more private, less utility.
- delta
Failure probability for approximate DP;
0requests pure \(\epsilon\)-DP (only the Laplace mechanism supportsdelta = 0).- unit
Privacy unit.
"person"(default) protects an individual across all their rows;"row"is weaker and cheaper (each row independent).- max_rows_per_person
Cap on how many rows one person may contribute, used to bound sensitivity at
unit = "person".NULL(default) uses1(each person contributes at most one row); rows beyond the cap are dropped by per-person subsampling before measuring. Set this from public domain knowledge when a person legitimately has several rows. For a longitudinal DP release (astructurewith a nesting index), this must be>= 2– it caps the transition sensitivity – and the per-person prefix of that many rows is kept in temporal order. For a linked DP release (synth_linked()) it is the maximum children kept per parent – a single integer applied to every child table, or a named vector/list keyed by child-table name (e.g.list(admissions = 8, labs = 20)) – and the root cap is always 1.- mechanism
Noise mechanism:
"laplace"(pure \(\epsilon\)-DP) or"gaussian"(approximate DP with zCDP composition; needsdelta > 0).- dependence
Dependence structure of the generative model:
"tree"(default; a Chow-Liu tree over pairwise marginals) or"independent"(one-way marginals only).- structure_frac
Budget-efficient structure learning for the flat
dependence = "tree"release (synth()with three or more variables).NULL(default) measures all \(\binom{d}{2}\) pairwise marginals at full fidelity and reuses them as both the Chow-Liu weights and the tree's conditionals. A number in(0, 1)instead spends only that fraction of the marginal budget on a cheap all-pairs scan used solely to select the tree, then concentrates the remaining1 - structure_fracon re-measuring just the \(d - 1\) chosen edges (plus thedone-way marginals) – so the budget lands on the parameters that survive into the model instead of on pairs that are discarded. Structure selection tolerates noise well, so a small slice (e.g.0.2-0.3) usually sharpens the retained edges, more so as the number of variables grows. Both passes compose into the same exact (\(\epsilon\), \(\delta\)) budget. Inert fordependence = "independent", for fewer than three variables (the tree is then trivial), and for longitudinal / linked DP releases (which keep the single-pass fitter).- degree
Fan-in of the Bayesian network fitted for a flat
synth()dependence = "tree"release.1(default) keeps the Chow-Liu tree exactly as before (each variable conditions on at most one parent).2or more opts into PrivBayes' GreedyBayes: a degree-kBayesian network in which each variable may condition on up todegreeof the already-generated variables, its parent set chosen greedily with the exponential mechanism (the parents whose joint the variable depends on most, crediting the parents\(\to\)child association only). Because a tree gives a variable a single parent, it cannot represent a variable that genuinely depends on two otherwise-unrelated predecessors (a "v-structure", e.g.Ca noisy XOR of independentAandB); a degree-2 network takes both parents and recovers it. Construction measures thedone-way marginals plus one(parents, node)family joint per non-root node (2d - 1marginals total) and spends aselect_fracslice on thed - 1greedy picks; every slice composes into the same exact (\(\epsilon\), \(\delta\)) (zCDP for Gaussian, pure \(\epsilon\) for Laplace). The network is forward-sampled ancestrally (no PGM inference), so like the tree it stays inference-free.degreeis capped tod - 1, and a high fan-in makes each family a(degree + 1)-way histogram – the samebins^(degree + 1)cell-count warning astreewidthapplies. Requiresdependence = "tree"; it is an alternative tostructure_fracand toselect = "adaptive"(setting either alongsidedegree > 1is an error), and is refused on longitudinal / linked releases. Ignored whendegree = 1.- select
How the marginals that make up the model are chosen, for a flat
synth()release."fixed"(default) measures a predetermined set (all one-way marginals, plus – fordependence = "tree"– pairwise marginals), exactly as described above; every existing path is unchanged."adaptive"opts into an AIM-style iterative selector: after measuring the one-way marginals it builds the dependency model one marginal at a time, at each step using the exponential mechanism to privately pick the marginal whose true value the model-so-far fits worst, then measuring that marginal under the main mechanism. Selection and measurement each spend budget and compose exactly into the same (\(\epsilon\), \(\delta\)) (zCDP for Gaussian, pure \(\epsilon\) for Laplace); the number of rounds is fixed in advance from the variable count andtreewidth, so the accounting is data-independent. Unlikestructure_frac(which picks a tree from one free noisy scan), adaptive selection is model-error-guided and – attreewidth >= 2– can measure marginals that form loops, capturing higher-order interactions a Chow-Liu tree structurally cannot. Ignoresdependenceandstructure_frac(supplytreewidth/select_fracinstead – settingstructure_fracalongside is an error)."aim"is Full AIM: it lifts the adaptive selector's running-intersection constraint, so the exponential mechanism may pick loopy marginals – a pair between two variables already in the model, the cycle a junction-tree selector structurally cannot close. Because a loopy set has no forward junction-tree sampler,"aim"reconciles the whole measured set (thedone-way marginals plus the selected pairs) into one graphical model over a triangulated junction tree by Private-PGM (belief propagation + mirror descent; seeestimator) and samples from that. It runs a data-independentmin(d (d - 1) / 2, treewidth * (d - 1))selection rounds, each rejecting any new pair whose triangulated clique would exceedtreewidth + 1; attreewidth = 1no loop can be closed, so it reduces to an adaptively-selected tree. Like"adaptive"it usestreewidth/select_frac(notstructure_frac/degree), and the reconciliation is budget-neutral. All selectors are currently flat-table only:"adaptive"/"aim"on a longitudinal or linked structure is refused.- treewidth
Adaptive selection only. Maximum clique size minus one in the junction-tree model – the ceiling on interaction order the model can hold.
1(default) builds a tree (each measured marginal is a pair; equivalent model class todependence = "tree", but selected adaptively).2lets the selector measure three-way marginals whose variables form triangles, so pairwise-invisible three-way structure survives, and3measures four-way cliques (interactions no three-way marginal can see, e.g. a 3-bit parity). Higher clique orders cost more per cell – a(w+1)-way histogram overbinscells per axis isbins^(w+1)cells, so the per-cell DP noise grows fast; a warning is raised when that count is large (binsis the numeric proxy; low-cardinality factor cliques are smaller). Raise it only when interactions of that order genuinely matter. Forselect = "aim"it bounds the model's triangulated clique size the same way (so1forbids loops and2permits triangles). Ignored unlessselect = "adaptive"orselect = "aim".- select_frac
Adaptive selection only. Fraction of the marginal budget spent on the private selection (the exponential-mechanism rounds); the remaining
1 - select_fracis spent measuring the chosen marginals (and the one-way marginals). Default0.25. Selection tolerates noise well, so a modest slice usually gives the best fidelity (the same intuition asstructure_frac); both slices compose into the same exact (\(\epsilon\), \(\delta\)). Ignored unlessselect = "adaptive"orselect = "aim".- anneal
Adaptive (
"adaptive"/"aim") selection only.FALSE(default) uses a fixed-round schedule with a uniform per-round budget.TRUEopts into AIM-style budget annealing – a data-adaptive round schedule: thedone-way marginals take a fair fixed share, then the marginal measurements and their exponential-mechanism selections start at a small per-round quantum (large noise) and double whenever a round's measured signal fails to beat its noise floor (AIM's \(\sigma\)-halving rule). After a baseline number of selection rounds – the spanning cliques for"adaptive", the treewidth-capped new pairs for"aim"– any surplus budget is spent on extra rounds that re-measure the worst-fit already-measured marginal (inverse-variance combined, so \(\rho\) / \(\epsilon\) adds exactly). The final round absorbs the exact remainder, so the total spend is still exactly (\(\epsilon\), \(\delta\)) – now over a variable number of rounds chosen from the data. Forselect = "adaptive"the model stays a spanning junction tree (no PGM inference), so refinement can only sharpen the measured cliques; forselect = "aim"the annealed set is triangulated and reconciled with Private-PGM exactly as in the fixed-round AIM, so refinement sharpens loopy marginals too. It is most useful when there are few variables and the fixed schedule would otherwise leave budget on the table. Ignored unlessselect = "adaptive"orselect = "aim"; setting it otherwise is an error.- estimator
How the measured marginals are turned into the generative model, for a flat
synth()tree or adaptive release."local"(default) is every existing path unchanged: each marginal is used locally – the tree takes the root's one-way and each edge's raw noisy 2-way as \(P(\text{child} \mid \text{parent})\), the adaptive junction tree each clique's own array – so the other one-way marginals, and the disagreement between overlapping noisy marginals, are discarded."pgm"opts into Private-PGM inference (McKenna et al.'s MST / graphical-model estimation): the whole set of measured marginals is reconciled into the single graphical-model distribution that best fits all of them at once (least squares), by belief propagation on a junction tree of the measured cliques plus entropic mirror descent, and the model is sampled from that. Because a tree (or the adaptive junction tree) has bounded treewidth, the inference is exact and cheap. Reconciliation is pure post-processing of the already-privatised marginals, so it spends no extra budget – the (\(\epsilon\), \(\delta\)) is identical to the same release with"local"; only the fitted model changes. It denoises (overlapping marginals are made mutually consistent) and lets the otherwise-discarded one-way marginals actually constrain the model, usually sharpening both the marginals and the conditionals at the same budget. Available for the flatdependence = "tree"release (degree-1) and forselect = "adaptive"; it is an alternative tostructure_frac, todegree > 1, and toanneal = TRUE(setting any of those alongsideestimator = "pgm"is an error), and there is nothing to reconcile independence = "independent". Refused on longitudinal / linked releases (flat-table only). Ignored (no-op) for"local".select = "aim"always reconciles with Private-PGM by construction (a loopy marginal set has no local sampler), soestimatoris moot there.- scoring
How
select = "aim"scores each candidate marginal in its exponential-mechanism rounds."auto"(default) picks the faithful choice per selector:select = "aim"uses"model"(AIM's actual quality function), and every other selector uses"independence"(where model scoring is inert)."model"scores each candidate against the current reconciled Private-PGM model's own marginal over that pair, so a loopy pair the model already explains (through the marginals measured so far) no longer looks surprising and the budget is steered to the genuinely worst-fit interaction."independence"is the cheaper opt-out: it scores a pair by how far its true joint sits from the product of its one-way marginals – the reference the other selectors use, and Full AIM's behaviour before this became the default. The model reference is read from the already-privatised marginals – reconciled each round and projected onto the candidate (a not-yet-measured pair projects across cliques of the junction tree) – so it is pure post-processing: the exponential mechanism's sensitivity and the exact (\(\epsilon\), \(\delta\)) are identical to"independence"; only which marginals get selected changes."model"costs extra computation (a reconciliation per selection round) and composes withanneal. Explicit"model"requiresselect = "aim"(an error otherwise); the adaptive selector's candidates always introduce a fresh variable, so its model projection reduces to the independence product anyway.- cross_table
Linked DP only (
synth_linked()). WhenTRUE, a child table's variables are conditioned on the synthetic parent's attributes: for each child table with a modellable immediate parent, parent-by-child joint marginals are measured (at the child's per-entity path-cap sensitivity, the same as a child one-way marginal) and folded into the child's Chow-Liu structure as fixed context nodes, so each child variable's single strongest predictor may be a parent variable or another child variable. The synthetic parent's already-drawn value then conditions the child draw, so cross-table statistical dependence – not just referential integrity – survives the noise. Costs extra budget (the added joints compose into the same (\(\epsilon\), \(\delta\)));FALSE(default) keeps child variables on their own within-table marginals. Ignored by flat / longitudinalsynth()releases, which have no parent table.- longitudinal
Linked DP only (
synth_linked()). Model a child table's repeated rows as a within-unit time series under DP, instead of exchangeable records: for such a table the children-per-parent count model doubles as a trajectory-length model, an initial-state model is measured over each unit's first (temporally earliest) child row, and a first-order Markov transition matrix \(P(v_t \mid v_{t-1})\) is measured per variable over consecutive within-unit rows (ordered by the child's own key index). Sensitivities differ by histogram – initial marginals at the parent's path cap, transitions atpath_cap[parent] * (branching_cap - 1)– and fold into the same exact (\(\epsilon\), \(\delta\)) budget. PassTRUEto model every eligible child table (a child with a branching cap \(\ge\) 2 and at least one variable), or a character vector of child-table names to model only those. The child's branching cap inmax_rows_per_personbounds the transition sensitivity, so it must be \(\ge\) 2 for a named table, and the prefix of that many rows is kept in temporal order. Settingcross_table = TRUEtogether with a longitudinal model on the same table combines them: the table's initial-state model is cross-conditioned on the synthetic parent (adding the parent-by-child joints at the same first-row sensitivity as the initial marginals), and the transition chain then carries that parent dependence across the trajectory – the parent shapes where a trajectory starts, while the transitions stay parent-free, so the only extra cost is the initial-state joints.FALSE(default) treats child rows as exchangeable. Ignored by flat / longitudinalsynth()releases (which pick the DP Markov engine straight from thestructureformula).- baseline
Longitudinal releases. Names of subject-invariant columns – baseline covariates that do not change across a unit's rows (e.g. birth sex, a baseline measurement). These are held exactly constant within each synthetic unit: they are modelled once in the initial-state model (so their joint distribution and their correlation with the first visit are preserved) and then broadcast to every row, rather than being stepped through a transition matrix that would let them drift. Declaring a column baseline is public schema knowledge, so it costs no budget; it also removes that column's transition histogram from the release, sharpening every remaining measurement at the same (\(\epsilon\), \(\delta\)). Applies to a longitudinal
synth()release (astructurewith a nesting index) and, per table, to any longitudinally-modelled linked child (the names are matched against each such child's own columns).NULL(default) treats every column as time-varying. Names that match no modelled column are ignored. Ignored by a flatsynth()release (one row per unit) and by non-longitudinal linked child tables.- transition_order
Longitudinal releases. Markov order of the within-unit transition model: how many of a variable's own immediately preceding values condition its next value.
1(default) is the first-order model \(P(v_t \mid v_{t-1})\);2gives \(P(v_t \mid v_{t-1}, v_{t-2})\), and so on. Higher orders capture momentum but need a larger row cap: the order must be at mostmax_rows_per_person - 1– for a linked release, one less than the branching cap of each longitudinally-modelled child (validated per table). A unit then contributes at mostcap - ordertransition tuples per variable, so the transition sensitivity – and hence the noise – actually drops with order, at the price of a finer conditioning grid (sparser cells) and of not modelling the earliest rows' own dynamics separately: rows before positionorder + 1are generated by marginalising the same measured tensor, which is post-processing and costs no budget. Applies to a longitudinalsynth()release and, uniformly, to every longitudinally-modelled linked child; ignored by flat releases and non-longitudinal linked children.- transition_cross
Longitudinal releases. Number of other variables (each at lag 1) that additionally condition each variable's transition – moving from \(P(v_t \mid v_{t-1}, \dots)\) to also conditioning on \(u_{t-1}\) for the
transition_crossmost strongly associated companionsu. Cross-parents are selected automatically and budget-neutrally from the pairwise marginals the Chow-Liu tree already measures (contemporaneous mutual information, a leak-free proxy for lag-1 cross-predictiveness) – for a linked child that means its own within-child pairwise marginals – sotransition_cross > 0requiresdependence = "tree". Adding conditioning columns does not change the (\(\epsilon\), \(\delta\)) budget – a transition tuple still lands in exactly one cell – it trades budget-free structure for cell sparsity, so keep it small.0(default) conditions each variable on its own past only. Applies to a longitudinalsynth()release and to every longitudinally-modelled linked child; ignored by flat releases and non-longitudinal linked children.- transition_parent
Linked DP only (
synth_linked()), longitudinal children. Number of immediate-parent attributes that additionally condition each time-varying child variable's transition. Todaycross_table = TRUEcross-conditions only a longitudinal child's initial state on the synthetic parent; the parent's influence then rides the own-lag chain and decays.transition_parent = pinstead re-injects the (subject-invariant) parent attributes into the transition tensor at every step – moving from \(P(v_t \mid v_{t-1}, \dots)\) to also conditioning on the parent's \(w\) for thepparent attributeswmost strongly associated withv– so parent \(\to\) child dependence stays anchored across the whole trajectory rather than washing out. The parents are selected automatically and budget-neutrally from the parent-by-child joints that the cross-conditioned initial state already measures, so it costs nothing in the (\(\epsilon\), \(\delta\)) budget (a transition tuple still lands in exactly one cell – same sensitivity, same histogram count), trading budget-free structure for cell sparsity. Because it reuses those joints,transition_parent > 0requirescross_table = TRUEfor the child (an error is raised otherwise).0(default) leaves the transitions parent-free (the initial-state cross-conditioning is unaffected). Composes withbaseline,transition_orderandtransition_cross. Ignored by flatsynth()releases and non-longitudinal linked children, which have no parent trajectory to condition.- bins
Number of equal-width bins used to discretise each numeric variable (default 12). Finer grids sharpen one-way marginals but make the noisy two-way marginals used by
dependence = "tree"weaker per cell, so a moderate value usually gives the best correlation fidelity. Means and sums are largely unaffected (bin contents are decoded uniformly within the bin).- bounds
Optional named list giving
c(lower, upper)for numeric variables, used as public, data-independent bin edges. How variables not named here are handled depends ondomain.- domain
How the discrete domain is chosen for variables without public metadata:
"dp"(default) estimates numeric bin edges – and discovers barecharactercategory sets by DP set-union – under differential privacy and accounts for the cost;"public"requiresboundsfor every numeric variable and publicfactorlevels for every categorical (error otherwise) and spends no budget on the domain;"data"reads edges / levels from the data with a warning and excludes that step from the accounting (non-rigorous; benchmarking only).- domain_frac
Fraction of the privacy budget spent learning the domain under
domain = "dp"(default0.1) – numeric bin edges (exponential-mechanism quantiles) andcharactercategory sets (DP set-union). The slice is shared across those operations and composed with the marginal measurements, so the total spend is exactly (\(\epsilon\), \(\delta\)). Ignored unless some numeric variable needs estimating or somecharactercolumn needs discovering.
Details
The DP engine (Track B) is a marginal-based synthesiser in the
PrivBayes / MST lineage. Continuous variables are discretised into a public
grid; low-order marginals are measured under the chosen noise mechanism with
correct budget composition; and synthetic records are drawn from the resulting
model. With dependence = "tree" a Chow-Liu tree of pairwise dependencies is
learned from the same noisy marginals (no extra budget) so second-order
structure is retained; dependence = "independent" keeps only one-way
marginals. All noise calibration and composition is reported back on the
result (see the accounting printed by synth()).
Where the bin edges come from matters, because reading them from the data (its
min / max) is itself a data-dependent step that can leak an individual's
presence. domain controls this:
"dp"(default)Rigorous and automatic. Numeric variables named in
boundsuse those public edges at no cost; any other numeric variable has its working range estimated under differential privacy (a clamp-free exponential-mechanism quantile at each end). A barecharactercolumn has its category set discovered under differential privacy by DP set-union (a stability histogram: each present category's noisy count must clear a threshold that hides any category a single person could have created; rare categories fold into an"(other)"catch-all). Both estimations spend an accounted slicedomain_fracof the budget, so the reported (\(\epsilon\), \(\delta\)) is exact end to end. DP set-union needsdelta > 0(a threshold cannot hide a lone category's presence atdelta = 0), so a pure-\(\epsilon\) release still refusescharacter."public"Fully data-independent and free: every numeric variable must be given a public range in
bounds(an error is raised otherwise) and no budget is spent on the domain. The recommended mode when public ranges (codebook / physiological limits) are available."data"The non-rigorous legacy behaviour: bin edges are taken from the data range with a warning, and that step is excluded from the accounting. Kept only for benchmarking; do not use for a governed release.
Categorical variables carry their domain in their type: factor and logical
columns use their declared levels (public metadata, no leakage). In the "dp"
and "public" modes a bare character column is refused – convert it to a
factor with its full levels so the category set is public.
Examples
dp <- dp_control(epsilon = 1, delta = 1e-6, mechanism = "gaussian")
dp
#> <dp_control> differentially private synthesis (Track B)
#> epsilon : 1
#> delta : 1e-06
#> unit : person
#> mechanism : gaussian
#> dependence: tree
#> bins : 12
#> domain : dp (0.1 of budget for edges)
#> max rows/person: 1 (auto)