Metter. / Mixtapes / Methods Mixtape / AI-Assisted Field Research Methods

04 · AI-Assisted Field Research Methods

Synthetic Data Generation for Piloting and Privacy

A method for generating synthetic survey datasets that mimic the statistical properties (distributions, correlations, missingness patterns) of real data without containing any actual respondent information — enabling safe sharing of data for replication, instrument piloting before fieldwork, and code development without IRB-restricted access.


What it is

Synthetic data generation produces artificial datasets whose statistical properties — marginal distributions, correlations between variables, missing data patterns, demographic structures — closely resemble a real dataset, but where no row corresponds to a real respondent. Synthetic data can be generated from a real dataset (preserving its structure for safe sharing) or from domain knowledge and prior studies (creating a plausible dataset before fieldwork begins).

In development economics research, synthetic data have two main uses: (1) enabling code and instrument development before actual data collection (researchers can write and debug analysis code against a plausible synthetic dataset, so the analysis is ready when real data arrive); and (2) enabling data sharing for replication and verification without violating respondent confidentiality agreements or ethics approvals.

When to use it

Synthetic data are appropriate for: developing and testing data cleaning and analysis scripts before baseline data collection; sharing data with research partners or external verifiers whose IRB approval does not cover the real data; creating public-use datasets from sensitive surveys; and testing whether analysis code produces expected results under a known data-generating process.

Synthetic data are not a substitute for real data for inference. Statistical properties are preserved on average but specific observations are not real — any analysis that relies on the exact values of specific observations (e.g., matching algorithms using GPS coordinates) is invalid on synthetic data.

How it works

Generating synthetic data from domain knowledge. If no real data exist yet (pre-fieldwork), specify the data-generating process from prior literature and knowledge:

  1. Define variable names, types, and ranges.
  2. Specify marginal distributions for each variable (e.g., household size ~ Poisson(4.5); income ~ log-normal with mean and SD from comparable surveys).
  3. Specify correlations between variables (income and asset index correlated at r ≈ 0.6).
  4. Simulate the specified process to produce N observations.

Generating synthetic data from real data. Several approaches exist:

  • Parametric synthesis: fit a statistical model (multivariate normal, copula, or sequential regression) to the real data, then simulate from the fitted model.
  • Bootstrap: resample observations with replacement (simple but preserves exact values; not truly synthetic).
  • Deep learning synthesis: variational autoencoders (VAE) or generative adversarial networks (GAN) learn a high-dimensional representation of the data and generate new samples. These preserve complex non-linear relationships but require more data and expertise.
  • Differential privacy synthesis: generates synthetic data with provable privacy guarantees using algorithms like PrivSyn or MST. Required when strict privacy guarantees are needed; less accurate than other methods for small datasets.

Utility evaluation. After generating synthetic data, test whether it is “good enough” for its intended use: compare marginal distributions (KS test), correlation matrices, regression coefficients, and variance components between real and synthetic data. Report these comparisons as part of the synthetic data documentation.

Key decisions

Fidelity vs. privacy tradeoff. High-fidelity synthetic data that closely matches the real data is more useful but is also more likely to allow re-identification of specific respondents (membership inference attacks). Lower-fidelity synthetic data is safer but may not preserve the statistical properties needed for code testing. The right tradeoff depends on the sensitivity of the real data and the purpose of the synthetic data.

Handling sensitive variables. Variables that are directly identifying (names, phone numbers, GPS coordinates) or indirectly identifying (unique combinations of characteristics) require special handling. Options: exclude from the synthetic dataset; add noise; generalise to ranges; or replace with fictional values (fake names, randomly offset GPS coordinates).

Documentation. Synthetic data must be clearly labelled to prevent accidental use in analysis. Every synthetic dataset should include a README specifying: that the data are synthetic, the method used to generate them, what properties are preserved, and what analyses are and are not valid.

Caveats & common mistakes

Publishing analysis results from synthetic data as if from real data. Synthetic data are for development and testing, not for drawing substantive conclusions. Results from analysis on synthetic data are only meaningful as a check on code correctness under a known DGP — they say nothing about the real world.

Assuming synthetic data preserves all analysis-relevant properties. Synthetic data preserves the properties it was designed to preserve. A synthetic dataset generated to preserve pairwise correlations will not preserve higher-order interactions. A synthetic dataset generated from a parametric model will not preserve rare events or extreme values that fall outside the model’s support. Test the specific properties that matter for your analysis.

Not validating against real data. Synthetic data generated from domain knowledge before fieldwork should be updated and re-validated once real data arrive. If the real data look substantially different from the synthetic version, scripts written for the synthetic data may need modification.

Analysis Guide

# Generate synthetic tabular data using SDV (Gaussian Copula)
from sdv.single_table import GaussianCopulaSynthesizer
from sdv.metadata import SingleTableMetadata
import pandas as pd
from scipy.stats import ks_2samp

# Load real data (must be de-identified before synthesis)
real_df = pd.read_csv("survey_data.csv")

# Define metadata
metadata = SingleTableMetadata()
metadata.detect_from_dataframe(real_df)
# Manually set types for key variables if needed:
# metadata.update_column("hh_id", sdtype="id")

# Fit synthesizer and generate
synthesizer = GaussianCopulaSynthesizer(metadata)
synthesizer.fit(real_df)
synthetic_df = synthesizer.sample(num_rows=len(real_df))
synthetic_df.to_csv("synthetic_data.csv", index=False)

# Utility evaluation: compare marginal distributions
for col in ["income", "hh_size", "asset_index"]:
  stat, p = ks_2samp(real_df[col].dropna(), synthetic_df[col].dropna())
  print(f"{col}: KS stat={stat:.3f}, p={p:.3f}")

# Compare correlation matrices
import numpy as np
corr_real = real_df[["income", "hh_size", "asset_index"]].corr()
corr_syn  = synthetic_df[["income", "hh_size", "asset_index"]].corr()
print("Max correlation deviation:", np.abs(corr_real - corr_syn).values.max().round(3))

Reading the output

  • A KS test p-value below 0.05 for a variable means the synthetic marginal distribution differs significantly from the real distribution; this variable may need a different synthesis method (e.g., a parametric distribution specified from domain knowledge rather than learned from data).
  • Maximum correlation deviation above 0.10 between real and synthetic correlation matrices indicates the synthesizer is not preserving key predictor relationships; use a vine copula or conditional synthesis approach instead.
  • If a regression coefficient on a key predictor differs by more than 15% between real and synthetic data, the synthetic data will not reliably reproduce the analysis code’s behaviour — investigate which variable is driving the discrepancy.
  • Synthetic data that passes utility checks at the aggregate level may still fail for subgroups (e.g., minority ethnic groups with few observations); check utility within subgroups that matter for the analysis.
  • Every synthetic dataset file must contain a header or README noting it is synthetic, the SDV or synthpop version used, and the date generated — to prevent accidental use in substantive analysis.

Getting started

  • Synthetic Data Vault (SDV) — The most complete open-source library for generating synthetic tabular data. The single-table quickstart covers Gaussian copula synthesis from a real dataset in under 20 lines of Python. Includes built-in quality evaluation metrics.

  • Faker documentation — Python library for generating realistic fake personal data (names, addresses, phone numbers). Useful for replacing directly identifying fields in a dataset with plausible but fictional values before sharing.

  • Gretel.ai tutorials — Hands-on tutorials for synthetic data generation using neural methods (GANs, diffusion models). Includes a free cloud tier. The tabular tutorial is directly applicable to household survey data.

  • The Royal Society synthetic data primer — Non-technical overview of what synthetic data is, what it preserves, and what it does not. Useful background before deciding which generation method to use and how to document a synthetic dataset for publication.

  • Faker for R (charlatan) — R equivalent of Python’s Faker for generating fake identifying data. Covers names, addresses, and numeric data with locale support.

References

Drechsler, J. (2011). Synthetic Datasets for Statistical Disclosure Control: Theory and Implementation. Springer.

Jordon, J., Szpruch, L., Houssiau, F., Bottarelli, M., Cherubin, G., Maple, C., Cohen, S. N., & Weller, A. (2022). Synthetic Data — What, Why and How? The Royal Society. https://arxiv.org/abs/2205.03257

Reiter, J. P., & Raghunathan, T. E. (2007). The multiple adaptations of multiple imputation. Journal of the American Statistical Association, 102(480), 1462–1471. https://doi.org/10.1198/016214507000000932

Rubin, D. B. (1993). Statistical disclosure limitation. Journal of Official Statistics, 9(2), 461–468.

Last updated: 5 June 2026