cleverly.datasets.make_heterogeneous#

cleverly.datasets.make_heterogeneous(n: int = 1000, *, seed: int | Generator | None = None, slope: float = 1.5, backend: Literal['pandas', 'polars'] | str | None = None) → tuple[Any, dict[str, float]][source]#

A sample whose treated and control populations have genuinely different effects.

Use this wherever a test needs att, ate and atc to be distinguishable and ordered in a known direction – att > ate > atc – rather than merely unequal.

Parameters:
nint

Number of observations.

seedint, Generator, or None

Seed or NumPy random generator.

slopefloat

Strength of the effect’s dependence on the covariate.

backend{“pandas”, “polars”, “pyarrow”} or None, default=None

Dataframe backend. None uses pandas when installed, then the first available backend.

Returns:
dataframe

Simulated observations whose treatment effect varies with the covariates.

truthdict of str to float

Exact causal parameters for the data-generating process.