Skip to content

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

synvey

R-CMD-check pkgdown License: GPL v2

Robust Synthetic Data Generation -- protecting data quality from contaminated training data.

Real-world microdata often contain outliers, coding errors, or measurement artifacts. Standard synthesis methods (OLS, CART) propagate these errors into the synthetic output, degrading utility and inflating disclosure risk. synvey replaces the conditional models in sequential synthesis with MM-estimators for continuous variables (50% breakdown point, 95% asymptotic efficiency) and Huber-weighted logistic regression for categorical variables. The result is synthetic data whose statistical properties are close to the clean data-generating process, even when the training data are contaminated.

Installation

# install.packages("remotes")
remotes::install_github("matthias-da/synvey")

Quick example

We use the Crohn's-disease dataset from robustbase, which is mixed-type (continuous + factors) and contains real outliers in BMI and the number of adverse events (nrAdvE):

library(synvey)

data(CrohnD, package = "robustbase")    # 117 patients, 9 variables
dat <- CrohnD[, -1]                     # drop opaque ID column

# Inject extra block contamination on a handful of rows, so the demo
# shows that robust synthesis tolerates more than just the data's own
# natural outliers.
dat_c <- dat
dat_c[1:5, c("BMI", "height", "weight")] <-
  dat_c[1:5, c("BMI", "height", "weight")] + 10

# Robust synthesis (MM for continuous, Huber-weighted logistic for factors)
res <- robsynth(dat_c, method = "robust_conditional", seed = 42)
res

# Utility assessment against the *clean* reference
u <- synth_utility(dat, res$synth)
u$pMSE
u$correlation

# Risk assessment
r <- synth_risk(dat, res$synth)
r$TCAP

Key features

  • Robust MM synthesis -- MM-estimation via robustbase::lmrob for continuous variables; weighted multinomial logit for categorical variables.
  • Contamination detection -- optional cellwise contamination filtering (method = "contam_filter") downweights suspicious cells before synthesis.
  • Utility metrics -- propensity score MSE (pMSE), Kolmogorov-Smirnov statistics, regression coefficient preservation, correlation matrix distance, and empirical distribution overlap.
  • Risk metrics -- k-anonymity, closest-record distance, membership inference AUC, and Target Correct Attribution Probability (TCAP).
  • Risk-utility frontier -- risk_utility_frontier() compares multiple synthesizers on the Duncan-Lambert R-U confidentiality map and identifies Pareto-optimal methods.

Comparison with synthpop

synvey adds robustness to the sequential synthesis framework popularized by synthpop. Under contamination, MM-based synthesis reduces pMSE by 44--59% compared to non-robust methods (OLS, CART), while maintaining comparable disclosure risk levels.

Citation

If you use synvey in your work, please cite:

Templ, M. (2026). Robust synthetic data generation: protecting data quality from contaminated training data. Working paper.

License

GPL (>= 2). See LICENSE for details.

About

Design-Aware Synthetic Data Generation (synvey R package; robSynth successor)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages