cleverly.datasets.make_randomized_pilot#
- cleverly.datasets.make_randomized_pilot(n: int = 1000, *, seed: int | Generator | None = None, backend: Literal['pandas', 'polars'] | str | None = None) tuple[Any, dict[str, float]][source]#
Draw the randomized pilot of the navigation offer, with its recorded offer chances.
- Parameters:
- Returns:
dataframeOne row per discharge:
transition_success(1 or 0),transition_navigation(the offer, 1 or 0),high_risk(1 whendischarge_riskis above 0),discharge_risk,prior_utilization,medication_burden,age, and the recorded chanceschance_no_offerandchance_offer.- truth
dictofstrtofloat The exact values of
randomized_pilot_truth().
See also
cleverly.datasets.randomized_pilot_truthThe exact truth of this law.
cleverly.datasets.navigation_protocolThe protocol of the program these data describe.
Notes
The offer chance is 0.2 in the low-risk group and 0.8 in the high-risk group (
PILOT_OFFER_CHANCES). The high-risk group also has a lower success rate, so a plain comparison of offered and other patients is confounded by the risk group. The module docstring gives the law.Examples
>>> from cleverly.datasets import make_randomized_pilot >>> frame, truth = make_randomized_pilot(n=500, seed=3) >>> frame.shape (500, 9) >>> sorted(frame.groupby("high_risk")["chance_offer"].first().round(2)) [0.2, 0.8]