Day 4. Common Distributions & the Data-Generating Process
The handful of distributions that model most economic data, and how to write a DGP with potential outcomes.
- ●Compute probabilities, means and variances for the Bernoulli, binomial, Poisson, uniform, normal, exponential and log-normal distributions.
- ●Derive the mean of the binomial, Poisson and log-normal distributions.
- ●Write a data-generating process (DGP) for a randomised and for a confounded study.
- ●Show how a confounded DGP creates selection bias in a naive comparison.
Theory
A small toolkit of distributions
| Distribution | Typical use | Support | Mean | Variance |
|---|---|---|---|---|
| Bernoulli() | treated or not, employed or not | |||
| Binomial() | successes in trials | |||
| Poisson() | counts: patents, visits, claims | |||
| Uniform() | random draws, lotteries | |||
| Normal() | test scores, errors, estimators | |||
| Exponential() | durations: unemployment spells | |||
| Log-normal() | wages, firm size, health costs |
Key formulas:
Any normal variable can be standardised: , and denotes the standard normal CDF. Independent normals add: if and are independent, .
The data-generating process
A DGP is a recipe that says how each variable is produced. Writing one forces you to state your assumptions, and simulating it lets you check whether an estimator recovers the truth. A causal DGP specifies potential outcomes and how treatment is assigned:
Here the true effect is 5 for everyone. Whether a naive comparison recovers 5 depends on the second line (Exercise 15).
Causal link. Every method in this course will be checked against a simulated DGP whose true effect you know. Learning to write DGPs today is learning how to test causal estimators.
Part 1 · Warm-up
Exercise 1 · Binomial attendance
Each of 10 training sessions is attended with probability 0.3, independently. Find , and .
Show solution
Step 1. . The number of ways to pick which 3 sessions are attended: .
Step 2. Probability of one particular pattern with 3 attended and 7 missed: .
Step 3. Multiply: .
Step 4. Moments: and .
Answer: , mean 3 sessions, variance 2.1.
Exercise 2 · Poisson claims
Insurance claims per month are Poisson with . Find and .
Show solution
Step 1. Poisson pmf: with .
Step 2. .
Step 3. .
Step 4. .
Answer: a claim-free month has probability 1.8%; at most one claim, 9.2%.
Exercise 3 · Standardising wages
Wages are . What share earn more than $65,000?
Show solution
Step 1. Standardise: .
Step 2. .
Answer: about 6.7% of workers earn more than $65,000.
Exercise 4 · Unemployment duration
Spell length (months) is exponential with mean 2, i.e. . What is ?
Show solution
For the exponential, , so .
Exercise 5 · A uniform lottery
A lottery assigns a voucher uniformly between $20 and $40. Find the mean and variance.
Show solution
Mean ; variance .
Part 2 · Proofs
Exercise 6 · Binomial moments from Bernoullis
Write with independent . Derive and .
Show solution
By linearity, . Because the are independent, their covariances are zero (Day 5), so variances add: .
Exercise 7 · The Poisson mean
Show that for .
Show solution
Exercise 8 · Memorylessness
Prove that the exponential distribution satisfies .
Show solution
A worker unemployed for 6 months is no more likely to find a job next month than one just laid off. Real data usually show duration dependence, which is evidence against the exponential model.
Exercise 9 · Sums and differences of normals
and are independent. Find the distributions of and .
Show solution
Step 1. .
Step 2. For the difference, , so .
Step 3. Variances add even when you subtract, which is why the standard error of a difference in means is larger than either group's.
Exercise 10 · The log-normal mean
If , show that .
Show solution
Step 1. Let .
Step 2. Then .
Step 3. Complete the square in the exponent:
Step 4. The remaining integral is a density, which integrates to 1, leaving .
Step 5. Note , as Jensen requires.
Part 3 · Applied
Exercise 11 · Rare events
1,000 firms each go bankrupt this year with probability 0.002, independently. Compare the exact binomial probability of no bankruptcies with the Poisson approximation.
Show solution
Step 1 (exact). , so .
Step 2. Evaluate with logs: , so .
Step 3 (approximation). , so the Poisson gives .
Answer: 0.1350 versus 0.1353. With many firms and a small probability each, the Poisson is an excellent approximation.
Exercise 12 · Overdispersion
Doctor visits have sample mean 3 and sample variance 12. Is a Poisson model reasonable?
Show solution
Step 1. A Poisson model forces .
Step 2. Here the variance is times the mean: overdispersion.
Step 3. Likely cause: unobserved differences between people (health, insurance, distance to the clinic) make the visit rate vary across individuals, which adds variance.
Answer: a pure Poisson model is not reasonable. Use a negative binomial model, or Poisson regression with robust standard errors.
Exercise 13 · Mean versus median wage
Log wages are . Find the median and mean wage.
Show solution
Step 1. is normal, so its median equals its mean, 10. Because is increasing, it maps the median of to the median of :
Step 2. Mean of a log-normal (Exercise 10) with , :
Answer: median ≈ $22,026 and mean ≈ $24,959. Right-skewed variables like wages have a mean above the median.
Exercise 14 · A randomised tutoring programme
A school district simulates a tutoring RCT. A pupil's test score without tutoring is ; tutoring adds 5 points to everyone, ; and a coin flip assigns tutoring, , independently of . Find and for the observed score .
Show solution
Step 1. Observed score: .
Step 2. Because is independent of , for both arms. So
Step 3. The difference is , the true effect.
Step 4. Variance of a sum of independent pieces: .
Answer: the difference in means is 5 (unbiased for the effect), and .
Exercise 15 · A confounded job-training DGP
Use the DGP in the theory block, read as job training: is high motivation (), motivated workers enrol more often, , and earnings (in $1,000) are . Compute and the selection bias.
Show solution
Step 1. Share enrolled: .
Step 2. Bayes' theorem for motivation among trainees and non-trainees:
Step 3. Conditional means ():
Step 4. Naive difference: . True effect: 5. Selection bias: , which is .
Answer: the naive comparison says training is worth $17k; $12k of that is motivated workers selecting into training.
Verify in Python
import numpy as np
from scipy import stats
print("Binomial P(X=3):", round(stats.binom.pmf(3, 10, 0.3), 4))
print("Poisson P(X<=1):", round(stats.poisson.cdf(1, 4), 4))
print("Normal tail:", round(stats.norm.sf(65_000, 50_000, 10_000), 4))
print("Exact vs Poisson:", round(0.998**1000, 4), round(np.exp(-2), 4))
print("Log-normal mean:", round(np.exp(10 + 0.5**2 / 2)))
# Exercise 15: simulate the confounded DGP
rng = np.random.default_rng(42)
n = 1_000_000
U = rng.binomial(1, 0.5, n)
T = rng.binomial(1, 0.2 + 0.6 * U)
Y = 10 + 5 * T + 20 * U + rng.normal(0, 1, n)
print("naive difference:", round(Y[T == 1].mean() - Y[T == 0].mean(), 2), "(true effect 5)")
Key takeaways
- A few distributions cover most data: Bernoulli/binomial for binary, Poisson for counts, exponential for durations, normal and log-normal for continuous outcomes.
- A DGP makes assumptions explicit and gives you a ground truth to test estimators against.
- When an unobserved variable drives both treatment and outcome, a naive comparison mixes the effect with selection bias.
Simulation Lab: Distribution Explorer & DGP Sampler
Open full screen →Seven distributions, their exact shape, moments, and a histogram of simulated draws.
Bars are 3,000 simulated draws; the line or dots are the exact distribution. Compare the theoretical and simulated moments.