cleverly.datasets.make_missing_outcome_bounded#
- cleverly.datasets.make_missing_outcome_bounded(n: int = 1000, *, seed: int | Generator | None = None, strength: float = 2.0, backend: Literal['pandas', 'polars'] | str | None = None) tuple[Any, dict[str, float]][source]#
Missing outcomes on the known support
(0, 1), with a nonlinear outcome mean.- Parameters:
- n
int Number of observations.
- seed
int,Generator,orNone Seed or NumPy random generator.
- strength
float The
strengthofmake_missing_outcome(). See its Notes.- backend{“pandas”, “polars”, “pyarrow”}
orNone, default=None Dataframe backend.
Noneuses pandas when installed, then the first available backend.
- n
- Returns:
See also
cleverly.datasets.make_missing_outcomeThe same mechanisms with an unbounded outcome.
Notes
The outcome is a proportion. Its known support is the open interval
(0, 1), so a cross-fitted fit can declareq_bounds=(0, 1). The bounds come from the law, not from the observed outcomes.missing_outcome_bounded_dgp()gives the outcome mean.At the default
strength=2the effect varies withW1, and the response probability falls asW1rises. The effect standardized to the respondents’ covariates therefore differs from the ATE.Examples
>>> from cleverly.datasets import make_missing_outcome_bounded >>> frame, truth = make_missing_outcome_bounded(n=200, seed=1) >>> list(frame.columns) ['Y', 'A', 'W1', 'W2', 'W3', 'Delta'] >>> observed = frame["Y"].dropna() >>> bool(observed.between(0.0, 1.0, inclusive="neither").all()) True