RCT Benchmark: t-test vs Linear Regression vs DML ATE

RCT Benchmark: t-test vs Linear Regression vs DML ATE

Generate RCT data

We'll generate a balanced (50/50) RCT with a continuous outcome where the treated group's mean exceeds control by 0.5 units.

ytx1x2x3x4x5
00.3028520.00.304717-1.0399840.7504510.940565-1.951035
1-0.9422061.0-1.3021800.127840-0.316243-0.016801-0.853044
20.9105241.00.8793980.7777920.0660311.1272410.467509
32.3324081.0-0.8592920.368751-0.9588830.878450-0.049926
4-1.0127320.0-0.184862-0.6809301.222541-0.154529-0.428328
........................
950.3054950.0-0.3392581.063852-1.1419380.0063392.597674
96-0.8658241.00.2230801.4332150.0915200.580777-0.056783
97-0.0278181.0-0.170408-0.7794820.430301-0.8515370.665585
98-1.2634720.01.0852870.366531-0.2862490.453966-0.308673
99-0.4213670.00.935547-1.831406-0.335607-1.990812-1.495061

100 rows × 7 columns

Wrap in CausalData

We provide a few covariates as confounders for DML (although the data is truly randomized).

countmeanstdminp10p25medianp75p90max
treatment
0.05010-0.0097971.005403-3.482370-1.290654-0.684156-0.0146630.6572981.2863373.627004
1.049900.5198861.007209-3.021571-0.746023-0.1652700.5034241.2063791.7909023.885919
mean_t_0mean_t_1abs_diffsmd
confounders
x2-0.0147650.0180330.0327980.032770
x1-0.022735-0.0082290.0145050.014486
x50.007285-0.0062290.013514-0.013459
x30.0145900.0077310.006859-0.006917
x4-0.000891-0.0000400.0008500.000838

1) t-test (difference in means)

{'p_value': 1.176719325899924e-147, 'absolute_difference': 0.5296827782315828, 'absolute_ci': (0.49023151024069744, 0.5691340462224682), 'relative_difference': 5406.753548476556, 'relative_ci': (5004.053494844908, 5809.453602108204)}

2) Linear regression

The coefficient on treatment equals the difference in group means in an RCT.

(0.5294584904981685, (np.float64(0.4899759986996098), np.float64(0.5689409822967272)), 0.02014449862854194, np.float64(0.0))

3) Double Machine Learning (ATE)

We estimate ATE using DoubleML with default learners.

{'coefficient': 0.5438121651196453, 'std_error': 0.021106462512239948, 'p_value': 2.1780238928091667e-146, 'confidence_interval': (0.5024442587546102, 0.5851800714846803), 'model': <doubleml.irm.irm.DoubleMLIRM at 0x1683801a0>}

Compare estimates

methodestimateci_lowerci_upper
0t-test0.5296830.4902320.569134
1linear_regression0.5294580.4899760.568941
2dml_ate0.5438120.5024440.585180

Ground truth theta = 0.5