cleverly.datasets.point_survival_truth#

cleverly.datasets.point_survival_truth(assign: Callable[[int, int], Sequence[float]], *, arms: int = 2, causes: int = 1, n_times: int = 5, time_varying: bool = False, dose: str | None = None, continuous_event_time: bool = False, grid: Sequence[float] | None = None, end_of_study: bool = False, weight: Callable[[int, int], float] | None = None, hazard_scale: Mapping[int, float] | None = None) → ndarray[tuple[Any, ...], dtype[float64]][source]#

The exact truth of make_point_survival() under an intervention on \(A\).

Parameters:
assigncallable()

assign(w1, w2) returns the intervention’s probability of each treatment level, in level order. A static arm is one-hot, a rule is one-hot by covariate, a stochastic policy is a density, and a modified treatment policy is the law of the shifted treatment.

arms{2, 3}

The number of arms, as for make_point_survival().

causes{1, 2}

The number of causes.

n_timesint

The number of nodes.

time_varyingbool

Whether L_k enters the hazard.

dose{“discrete”} or None

"discrete" for the dose on 0..5.

continuous_event_timebool

Whether the event time is exponential.

gridsequence of float or None

The grid of the continuous event time.

end_of_studybool

Whether the outcome is one Y after the censoring nodes.

weightcallable() or None

weight(w1, w2), an observation weight of the baseline stratum. The truth is then the parameter of the tilted law \(dP_w = w\,dP / E[w]\). None is no tilt.

hazard_scalemapping of int to float or None

A factor on the all-cause hazard at each listed node, as for make_point_survival().

Returns:
ndarray

(n_times, causes): the cumulative risk, or the incidence of each cause, at each node. On an end-of-study draw, a one-element array holding the mean outcome.