obs_linear_effect
Generate an observational dataset with linear effects of confounders and a constant treatment effect.
Parameters
- n (
int) – Number of samples to generate. - theta (
float) – Constant treatment effect. - outcome_type (
('continuous', 'binary', 'poisson', 'gamma')) – Family of the outcome distribution. - sigma_y (
float) – Noise level for continuous outcomes. - target_d_rate (
float) – Target treatment prevalence (propensity mean). - confounder_specs (
list of dict) – Schema for confounder distributions. - beta_y (
array - like) – Linear coefficients for confounders in the outcome model. - beta_d (
array - like) – Linear coefficients for confounders in the treatment model. - random_state (
int) – Random seed for reproducibility. - k (
int) – Number of confounders if specs not provided. - x_sampler (
callable) – Custom sampler for confounders. - include_oracle (
bool) – Whether to include oracle ground-truth columns like 'cate', 'm', etc. - add_ancillary (
bool) – If True, adds standard ancillary columns (age, platform, etc.). - deterministic_ids (
bool) – If True, generates deterministic user IDs.
Returns
DataFrame– Synthetic observational dataset.