cleverly.datasets.make_shift_dose#

cleverly.datasets.make_shift_dose(n: int = 1000, *, policies: Sequence[tuple[float, float | None, str]] = ((0.0, None, 'natural course'), (0.5, 5.0, '+0.5')), seed: int | Generator | None = None, backend: Literal['pandas', 'polars'] | str | None = None) → tuple[Any, dict[str, float]][source]#

A confounded continuous dose with known means under each declared shift.

The default policies are the natural course and a +0.5 shift capped at 5.0, which is what Shift would be given for the same analysis – and the names match, so the truth is keyed exactly as the estimator reports.

Parameters:
nint

Number of observations.

policiessequence of tuple

One (delta, cap, name) per policy the truth is computed for.

seedint, Generator, or None

Seed or NumPy random generator.

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

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

Returns:
dataframe

Simulated observations with a continuous dose column.

truthdict of str to float

Exact causal parameters for the data-generating process.