Skip to main content

Module datasets

Module datasets 

Source
Expand description

Simulated data sets: the data generating processes of DoubleML’s make_* functions, for examples, tests and simulation studies.

Every generator is a struct whose fields are the parameters, with DoubleML’s defaults, and generate(seed) draws a data set. The draws come from a seeded ChaCha generator, so they are reproducible but not identical to DoubleML’s NumPy draws; the distributions are the same.

use dml_core::datasets::PlrCcddhnr2018;
use dml_core::{learner::Ols, Plr};

let sim = PlrCcddhnr2018 { n_obs: 300, dim_x: 5, ..Default::default() }.generate(42).unwrap();
let fit = Plr::new(Ols::new(), Ols::new()).fit(&sim.to_data().unwrap()).unwrap();
assert!((fit.coef()[0] - 0.5).abs() < 0.3);
GeneratorDoubleMLDesign
PlrCcddhnr2018make_plr_CCDDHNR2018partially linear regression
PlrTurrell2018make_plr_turrell2018partially linear regression
ConfoundedPlrmake_confounded_plr_dataPLR with an unobserved confounder
PlivChs2015make_pliv_CHS2015partially linear IV, many instruments
PlivMultiwayClusterCkms2021make_pliv_multiway_cluster_CKMS2021PLIV with two-way clustering
LplrLzz2020make_lplr_LZZ2020logistic partially linear regression
PlprCp2025make_plpr_CP2025partially linear panel regression
IrmDatamake_irm_datainteractive regression, binary treatment
ConfoundedIrmmake_confounded_irm_dataIRM with an unobserved confounder
IrmDiscreteTreatmentsmake_irm_data_discrete_treatmentsmulti-valued treatment
IivmDatamake_iivm_databinary instrument (LATE)
SsmDatamake_ssm_datasample selection
HeterogeneousDatamake_heterogeneous_dataheterogeneous treatment effects
DidSz2020make_did_SZ2020two-period difference-in-differences
DidCs2021make_did_CS2021, make_did_cs_CS2021staggered adoption
SimpleRddmake_simple_rdd_dataregression discontinuity

Structs§

ConfoundedIrm
A binary treatment with an unobserved confounder A, as make_confounded_irm_data (Sant’Anna and Zhao covariates), with oracle confounding strengths for sensitivity analysis.
ConfoundedIrmOracle
Oracle values of ConfoundedIrm.
ConfoundedIrmSimulated
A data set of ConfoundedIrm.
ConfoundedPlr
A partially linear model with an unobserved confounder A of given strength (cf_y, cf_d), as make_confounded_plr_data, for sensitivity analysis. ConfoundedPlrSimulated::oracle holds the long and short regressions and the confounder.
ConfoundedPlrOracle
Oracle values of ConfoundedPlr.
ConfoundedPlrSimulated
A data set of ConfoundedPlr.
DidCs2021
Callaway and Sant’Anna (2021): staggered adoption over n_periods periods, with cohorts first treated from period n_pre_treat_periods on, dynamic and heterogeneous effects, unit and time effects.
DidSz2020
Sant’Anna and Zhao (2020): two periods, a binary treatment and the transformed covariates Z. generate gives a panel (y = Y₁ − Y₀); generate_cross_sections repeated cross-sections with a time indicator.
DiscreteTreatmentOracle
Oracle values of IrmDiscreteTreatments.
DiscreteTreatmentSimulated
A data set of IrmDiscreteTreatments.
HeterogeneousData
Heterogeneous treatment effects τ(x) = exp(2x₀) + 3 sin(4x₀) (or 3 sin(4x₁) with n_x = 2) on uniform covariates, as make_heterogeneous_data.
HeterogeneousSimulated
A data set of HeterogeneousData with the individual effects.
IivmData
A binary instrument z shifting a binary treatment, d = 1{α_x z + v > 0}, y = θd + x'β + u with corr(u, v) = 0.3.
IrmData
Belloni, Chernozhukov, Fernández-Val and Hansen (2017): binary treatment with P(d = 1 | x) = expit(c_d x'β) and y = θd + d·c_y x'β + ζ, with c_d, c_y set by the target R² values.
IrmDiscreteTreatments
A multi-valued treatment d ∈ {0, 1, …, n_levels}, as make_irm_data_discrete_treatments: a latent continuous treatment cut at its quantiles, with a share 1 / n_levels of untreated units.
LplrLzz2020
Liu, Zhang and Zhou (2020): a binary outcome with P(y = 1) = expit(αd + r₀(x)), equicorrelated covariates (0.2) clipped to [−2, 2]. generate also returns the outcome probabilities.
PlivChs2015
Chernozhukov, Hansen and Spindler (2015): partially linear IV with dim_z instruments z = x[:, :dim_z] + ξ.
PlivMultiwayClusterCkms2021
Chiang, Kato, Ma and Sasaki (2021): partially linear IV on an n × m grid of two-way clusters, with cluster-correlated covariates and errors.
PlprCp2025
Clarke and Polselli (2025): a static panel with correlated unit effects, d = m₀(x) + cᵢ + v, y = θd + g₀(x) + αᵢ + u.
PlrCcddhnr2018
Chernozhukov et al. (2018): d = a₀x₀ + a₁·expit(x₂) + s₁ε, y = αd + b₀·expit(x₀) + b₁x₂ + s₂ζ with Toeplitz-correlated covariates (0.7^|i−j|).
PlrTurrell2018
Turrell (2018): d = m(x'b) + ε, y = θd + g(x'b) + ζ with g(v) = sin²(v), m(v) = sinh(γ) / (2π(cosh(γ) − cos(v − ν))), b_k = 1/k and a random positive definite covariance (scikit-learn’s make_spd_matrix).
SimpleRdd
A simple RD design (make_simple_rdd_data): a normal score, uniform covariates entering through polynomials of order p, effect tau at the cutoff; sharp or fuzzy, with a continuous or binary outcome.
Simulated
A simulated cross-section: covariates x, outcome y, treatment d and, depending on the design, instruments z, a selection indicator s, a time indicator t or cluster labels (one column per clustering).
SimulatedPanel
A simulated panel in long format (one row per unit and period).
SimulatedRdd
A data set of SimpleRdd: running variable, covariates, outcome, treatment and both potential outcomes.
SimulatedStaggered
A simulated staggered-adoption panel in long format (periods 0, 1, …); cohort is the first treated period, f64::INFINITY for never treated units.
SsmData
Sample selection: the outcome is observed when s = 1, with s = 1{x'β + d + γz + e₀ > 0}; missing at random (mar, errors independent and γ = 0) or nonignorable (corr(e₀, e₁) = 0.8, γ = 1). Unobserved outcomes are 0.

Enums§

LplrTreatment
Treatment of LplrLzz2020.
PlprDesign
Functional form of PlprCp2025.