cleverly.datasets.make_missing_outcome#

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

Missing outcomes, with a missingness mechanism that depends on treatment.

P(Delta = 1 | A, W) depends on both A and W, so the complete cases carry a different covariate distribution from the sample – which is what the 1 / pi factor in the clever covariate corrects for. Note that this alone does not make a complete-case analysis biased: under missingness at random a correctly specified outcome regression identifies the estimand without any missingness model at all. The mechanism is what supplies the other half of double robustness, for when the outcome model is wrong. Raise strength above 1 for a process where it is.

Parameters:
nint

Number of observations.

seedint, Generator, or None

Seed or NumPy random generator.

strengthfloat

How hard the process is for a complete-case analysis. See the Notes.

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 an outcome column that holds missing values.

truthdict of str to float

Exact causal parameters for the data-generating process.