Statistical agencies need consistent marginals and releasable privacy reports when publishing synthetic microdata.
library(DPSynth)
data(acs_pums_sample)
set.seed(2)
synth <- dp_synthesize(acs_pums_sample, method = "copula",
epsilon = 3.0, delta = 1e-6, n_synth = 500,
risk_audit = FALSE)
#> Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
#> collapsing to unique 'x' values
#> Warning in regularize.values(x, y, ties, missing(ties), na.rm = na.rm):
#> collapsing to unique 'x' values
print(synth)
#> === Differentially Private Synthetic Data ===
#> Method: copula
#> Privacy: (epsilon = 3 , delta = 1e-06 )
#> Synthetic records: 500
#>
#> --- Utility Summary ---
#> Propensity pMSE ratio: 0.0026
#> Correlation distance: 0.0476
# Post-processing: enforce non-negative income
synth$synthetic_data$income <- pmax(synth$synthetic_data$income, 0)Consistency of released marginals:
u <- evaluate_univariate(synth$synthetic_data, acs_pums_sample)
u
#> variable ks_stat hellinger mean_rel_err sd_rel_err
#> 1 age 0.088 0.0566826325 0.029128257 0.02243788
#> 2 income 0.060 0.0007553531 0.006067363 0.04338308
#> 3 educ NA 0.0266975852 NA NA
#> 4 married NA 0.0016990554 NA NA
#> 5 weeks_worked 0.048 0.0860602763 0.004464953 0.01017332Releasing the privacy report alongside the synthetic file:
budget <- new_synth_budget(epsilon = 5, delta = 1e-6, accounting = "rdp")
budget <- spend_synth(budget, 3.0, description = "DP-copula synthesis")
#> Warning in spend_synth(budget, 3, description = "DP-copula synthesis"): Privacy
#> budget exceeded! Synthesis may not satisfy DP.
budget <- spend_synth(budget, 1.0, description = "DP marginal check")
#> Warning in spend_synth(budget, 1, description = "DP marginal check"): Privacy
#> budget exceeded! Synthesis may not satisfy DP.
check_synth_budget(budget)
#> remaining_epsilon spent_epsilon fraction_used
#> 0.000000 23.815511 4.763102