cleverly.survival.ContinuousSurvivalRecord#
- class cleverly.survival.ContinuousSurvivalRecord(hazards: tuple[HazardSelection, ...], censoring: HazardSelection, propensity: PropensitySelection | None, steps: int, halvings: int, converged: bool, cutoff: float, standardized_score: tuple[float, ...], initial_psi: tuple[float, ...], bounded_share: float, last_time_floor_share: float, jump_bound_share: float, jump_bound_at_risk_share: float, frozen_share: float, off_grid_share: float, cross_fitted: bool, n_folds: int, grid_size: int, arm: NDArray[int64], p1: NDArray[float64], retention_before: NDArray[float64], weight_floor: float, retention_at_time: NDArray[float64])[source]#
What the continuous-time fit chose and how its targeting ended.
- Parameters:
- hazards
tupleofHazardSelection The selection for each cause’s hazard, in cause order (the full-sample fit, or the first fold’s when cross-fitted).
- censoring
HazardSelection The selection for the censoring hazard.
- propensity
PropensitySelectionorNone The selection for the treatment model, or
Nonefor a user learner.- steps
int Accepted targeting steps.
- halvings
int Rejected steps.
- convergedbool
Whether every standardized score reached the cutoff.
- cutoff
float The bound on the largest \(|P_n D^*| / \hat\sigma\).
- standardized_score
tupleoffloat Each target’s final \(|P_n D^*| / \hat\sigma\).
- initial_psi
tupleoffloat Each target’s plug-in at the initial hazards, before any step, in target order.
- bounded_share
float The share of (unit, time) cells of each unit’s received arm, while it is followed, whose \(\pi S_c(u^-)\) was raised to the positivity floor.
- last_time_floor_share
float The share of (unit, arm) pairs, over both arms whatever the unit received, whose \(\pi S_c(u_M^-)\) at the grid’s end is below the floor: the counterfactual reach of the positivity bound. The grid ends at the last target time, or at the last restricted horizon when that is later.
- jump_bound_share
float The share of (unit, arm) pairs, over both arms, with a grid time at which the initial cause hazard jumps summed to one or more, and the engine scaled them to sum to \(1 - 10^{-8}\), each cause keeping its share (the jump bound). Under a Cox model with distinct event times such a cell is an extrapolation: a unit read at its counterfactual arm, or after it left follow-up. A fit with a nonzero share reads experimental and warns.
- jump_bound_at_risk_share
float The share of (unit, arm) pairs, over both arms, with such a cell at the unit’s received arm while it is at risk, which under a Cox model needs tied event times; the rest of
jump_bound_shareis extrapolation.- frozen_share
float The share of (unit, arm) pairs, over both arms, that the walk held for at least one trial step because that step would have taken their survival at the grid’s end below its floor. A pair is held for one step only.
- off_grid_share
float The share of random times in the window, among those where a score is not identically zero, at which the score equation holds to the cutoff. The window runs to the grid’s end, so on a fit with a restricted horizon past the last target time the share is not comparable with the registered study’s reading over the target times.
- cross_fittedbool
Whether the nuisances were fitted out of fold.
- n_folds
int The number of cross-fitting folds,
1for a full-sample fit.- grid_size
int The number of distinct observed times up to the last target time or restricted horizon.
- arm
ndarray (n,)each row’s received arm in row order:0for the reference arm and1for the treated arm, the codes ofarms.- p1
ndarray (n,)each row’s estimated probability of the treated arm (arm code 1, the non-reference arm) given its baseline covariates, \(\hat\pi(1 \mid L_i)\), in row order. It is predicted out of fold when the fit is cross-fitted and in sample otherwise. The values are as fitted, before any bound: the engine never bounds \(\hat\pi\) alone. It bounds the product \(\hat\pi(a \mid L) \hat S_c(u^- \mid a, L)\) below byweight_floor, for both arms, andbounded_sharecounts the cells of the received arm that bound raised.- retention_before
ndarray (2, n, n_target_times)each row’s estimated probability of remaining uncensored just before each target time had it received each arm, \(\hat S_c(t_k^- \mid a, L_i) = \prod_{u < t_k}\{1 - d\hat\Lambda_c(u \mid a, L_i)\}\) over the observed times \(u\). Axis 0 is the arm code, in the order ofarms(reference, then treated), and columnkishorizons[k]. Predicted asp1is, before any bound.- weight_floor
float The lower bound on \(\hat\pi(a \mid L)\hat S_c(u^- \mid a, L)\) that the targeting weights applied, exactly as resolved:
g_boundsas given, or \(5 / (\sqrt n \log n)\) for"auto".- retention_at_time
ndarray (n,)each row’s estimated probability of remaining uncensored just before its own observed time, at the arm it received, \(\hat S_c(\min(\tilde T_i, u_M)^- \mid A_i, L_i)\), with \(u_M\) the grid’s last time. Predicted asp1is, before any bound. No estimate reads it; the covariate balance of a unit whose event was observed before a target time does (covariate_balance()).
- hazards
Methods#
Attributes#
- ContinuousSurvivalRecord.censoring: HazardSelection#
- ContinuousSurvivalRecord.arm: NDArray[int64]#
- ContinuousSurvivalRecord.p1: NDArray[float64]#
- ContinuousSurvivalRecord.retention_before: NDArray[float64]#
- ContinuousSurvivalRecord.retention_at_time: NDArray[float64]#