cleverly.datasets.make_recovery_score#

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

Draw the three-decision navigation program with a 30-day recovery score.

Parameters:
nint, default=4000

The number of patients.

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:
framedataframe

One row per patient, with the columns lives_alone, discharge_risk, offer_discharge, symptoms_day10, offer_day10, symptoms_day20, offer_day20 and recovery_day30 in time order.

truthdict of str to float

ey_regimen[always], ey_regimen[never] and ate_regimen[always vs never], and the blip coefficients under the names a fit reports them by: an intercept at each offer, and a lives_alone coefficient at the first two.

See also

cleverly.datasets.recovery_score_truth

The exact mean score under one plan.

cleverly.datasets.recovery_score_protocol

The study description of the program.

Examples

>>> from cleverly.datasets import make_recovery_score
>>> frame, truth = make_recovery_score(10, seed=0)
>>> frame.shape
(10, 8)
>>> round(truth["ate_regimen[always vs never]"], 4)
11.215