cleverly.datasets.contact_schedules_truth#

cleverly.datasets.contact_schedules_truth(tilts: Mapping[str, Mapping[str, float]] | None = None, reference: str | None = None) → dict[str, float][source]#

Return the exact mean score under each schedule and each odds tilt, and each contrast.

Parameters:
tiltsmapping or None

Each tilt’s name mapped to its odds factors, a mapping from a level of SCHEDULE_LEVELS to a positive factor. A level a tilt leaves out keeps the factor 1, so an empty mapping is current practice. None asks for no tilt.

referencestr or None

The tilt each tilt contrast is taken against. None takes the first tilt.

Returns:
dict of str to float

ey[<level>], the mean transition score if every patient got that schedule; ey_ipsi[<name>], the mean under each tilt; and ate_ipsi[<name> vs <reference>] for each other tilt. The keys are the names that an ATE or an IncrementalEffect fit reports.

See also

cleverly.datasets.make_contact_schedules

Draws data from this law.

Notes

The module docstring gives the law. The covariates enter through a smooth integrand, so a 40-node Gauss-Hermite rule in each of the three covariates is exact to about 1e-12.

Examples

>>> from cleverly.datasets import contact_schedules_truth
>>> truth = contact_schedules_truth({"now": {}, "more": {"medium": 1.5, "high": 2.0}})
>>> round(truth["ate_ipsi[more vs now]"], 4)
0.0174