liveBook · Manning

Synthetic data

As explained in Causal Inference for Data Science

Synthetic data are artificially generated observations produced from a specified model rather than collected from real-world events.

Synthetic data are observations generated from a chosen data-generating process rather than collected from real-world events. They let you specify how variables relate, including noise, confounding, treatments, and outcomes, then check whether an analysis recovers what you deliberately built in. section 1.4.1 section 11.0

Use synthetic data when a causal question needs a trustworthy test bed: real data reveal outcomes but not the rules that produced them. By creating the rules yourself, you know the ground truth and can compare an estimated effect with the intended effect. This builds confidence before applying a method to real-world data, but it cannot provide the certainty of a real experiment or A/B test. section 1.2 section 11.0

A practical simulation starts by making the causal story explicit:

  • Name the relevant variables and draw the causal graph or otherwise state their relationships. section 6.1.1
  • Choose distributions, sample size, coefficients, and random error for each generated variable. section 9.3 section 6.1.1
  • Generate data from those rules, retaining the known treatment effect or potential outcomes as ground truth. section 9.3 section 11.2.1
  • Run naive and causal analyses, then compare their estimates with the known answer to expose bias or validate the procedure. section 9.3 section 11.0

A correlation created by population

Generate population over time, then generate arcade revenue and computer-science doctorates independently from population. Revenue and doctorates can show a 0.95 correlation even though neither was generated from the other. The point is not to prove population explains a real association; it is to make a third-factor mechanism visible and test how easily correlation can mislead. section 1.4.1

Listing 1.1 (R) Building a synthetic dataset that creates spurious correlations
set.seed(1234)

time <- 2000:2009
population <- 280 + 3 * (time - 2000) +
    rnorm(n=length(time), sd=0.1)  #1
revenue <- 1.25 + (population - 280) * 0.015 +
    rnorm(n=length(time), sd=0.05)  #2
)
doctorates <- 700 + (population - 280) * 30 +
    rnorm(n=length(time), sd=10)  #3

cor(doctorates, revenue)

Inspect the R simulation that generates population, revenue, and doctorates separately, then calculates their misleading correlation. section 1.4.1

Known truth exposes biased estimation

In an instrumental-variables simulation, an unobserved confounder affects treatment and outcome while an instrument affects treatment. The built-in treatment effect is −2. A regression using treatment alone estimates about +1, whereas the IV estimate is about −1.89, making the confounding bias and the method’s improvement directly checkable. section 9.3

Realism can be added without surrendering control. A time-event simulation creates both potential outcomes, includes seasonality, and models a movie-release effect that is largest at time zero and declines afterward. Such design lets a method face plausible patterns while preserving a known answer. section 11.2.1

How Causal Inference for Data Science covers it

How deep it goes
Works through variable-generation equations, noise, potential outcomes, and comparisons between naive and causal estimates.
Examples
Uses population-driven arcade revenue and doctorates, hotel pricing, game levels, instruments, and a movie-release time series.
What it assumes
Begins with made-up variables and relationships, then uses causal graphs, regression, and potential outcomes in worked simulations.
What you can do after
Evaluate/understand whether an estimator recovers a known causal effect and how confounding can bias naive analysis.
How it connects
Connects causal inference with confounding, instrumental variables, potential outcomes, regression discontinuity design, synthetic controls, and difference-in-differences.

Also explained in

Compare how 15 books explain synthetic data →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Causal Inference for Data Science. The section links point to the parts of the book it draws on.