causalis.dgp.multicausaldata.functional.generate_multitreatmentgenerate_multitreatment
Generate a multi-treatment dataset using MultiCausalDatasetGenerator.
Parameters
- nint, default=10_000
Number of samples.
- n_treatmentsint, default=3
Number of treatment classes (including control).
- outcome_type{“continuous”, “binary”, “poisson”, “gamma”}, default=”continuous”
Outcome family.
- sigma_yfloat, default=1.0
Noise level for continuous outcomes.
- alpha_yfloat, default=0.0
Outcome intercept on the structural link scale.
- gamma_shapefloat, default=2.0
Shape parameter when
outcome_type="gamma".- taucallable or list of callables, optional
Heterogeneous treatment effects per class. When provided with
theta, the structural effect is additive on link scale (theta + tau(X)).- target_d_ratearray-like, optional
Target marginal class probabilities (length K).
- confounder_specslist of dict, optional
Schema for confounder distributions.
- beta_yarray-like, optional
Linear coefficients for outcome model.
- g_ycallable, optional
Nonlinear baseline outcome function added on the link scale.
- beta_darray-like, optional
Linear coefficients for treatment model.
- g_dcallable or list of callables, optional
Nonlinear treatment score function(s) added on the softmax-link scale.
- thetafloat or array-like, optional
Constant treatment effects per class (adds to
tauwhen both are provided).- random_stateint, optional
Random seed.
- kint, default=0
Number of confounders if confounder_specs is None.
- x_samplercallable, optional
Custom sampler for confounders.
- use_copulabool, default=False
Whether to use Gaussian copula sampling for confounders.
- copula_corrarray-like, optional
Correlation matrix used when
use_copula=True.- include_oraclebool, default=True
Whether to include oracle columns.
- return_causal_databool, default=False
Whether to return a MultiCausalData object.
- d_nameslist of str, optional
Names of treatment columns.
Returns
pd.DataFrame or MultiCausalData
Notes
Treatment columns form a mutually exclusive one-hot representation:
exactly one treatment column equals
1for each row;d_names[0]is the control arm;arm-specific structural effects are defined on the outcome link scale and are mapped back to the natural outcome scale in oracle outputs.
Examples
Canonical target
causalis.dgp.multicausaldata.functional.generate_multitreatment
Sections