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:
hazardstuple of HazardSelection

The selection for each cause’s hazard, in cause order (the full-sample fit, or the first fold’s when cross-fitted).

censoringHazardSelection

The selection for the censoring hazard.

propensityPropensitySelection or None

The selection for the treatment model, or None for a user learner.

stepsint

Accepted targeting steps.

halvingsint

Rejected steps.

convergedbool

Whether every standardized score reached the cutoff.

cutofffloat

The bound on the largest \(|P_n D^*| / \hat\sigma\).

standardized_scoretuple of float

Each target’s final \(|P_n D^*| / \hat\sigma\).

initial_psituple of float

Each target’s plug-in at the initial hazards, before any step, in target order.

bounded_sharefloat

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_sharefloat

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_sharefloat

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_sharefloat

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_share is extrapolation.

frozen_sharefloat

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_sharefloat

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_foldsint

The number of cross-fitting folds, 1 for a full-sample fit.

grid_sizeint

The number of distinct observed times up to the last target time or restricted horizon.

armndarray

(n,) each row’s received arm in row order: 0 for the reference arm and 1 for the treated arm, the codes of arms.

p1ndarray

(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 by weight_floor, for both arms, and bounded_share counts the cells of the received arm that bound raised.

retention_beforendarray

(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 of arms (reference, then treated), and column k is horizons[k]. Predicted as p1 is, before any bound.

weight_floorfloat

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_bounds as given, or \(5 / (\sqrt n \log n)\) for "auto".

retention_at_timendarray

(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 as p1 is, before any bound. No estimate reads it; the covariate balance of a unit whose event was observed before a target time does (covariate_balance()).

Methods#

Attributes#

ContinuousSurvivalRecord.hazards: tuple[HazardSelection, ...]#
ContinuousSurvivalRecord.censoring: HazardSelection#
ContinuousSurvivalRecord.propensity: PropensitySelection | None#
ContinuousSurvivalRecord.steps: int#
ContinuousSurvivalRecord.halvings: int#
ContinuousSurvivalRecord.converged: bool#
ContinuousSurvivalRecord.cutoff: float#
ContinuousSurvivalRecord.standardized_score: tuple[float, ...]#
ContinuousSurvivalRecord.initial_psi: tuple[float, ...]#
ContinuousSurvivalRecord.bounded_share: float#
ContinuousSurvivalRecord.last_time_floor_share: float#
ContinuousSurvivalRecord.jump_bound_share: float#
ContinuousSurvivalRecord.jump_bound_at_risk_share: float#
ContinuousSurvivalRecord.frozen_share: float#
ContinuousSurvivalRecord.off_grid_share: float#
ContinuousSurvivalRecord.cross_fitted: bool#
ContinuousSurvivalRecord.n_folds: int#
ContinuousSurvivalRecord.grid_size: int#
ContinuousSurvivalRecord.arm: NDArray[int64]#
ContinuousSurvivalRecord.p1: NDArray[float64]#
ContinuousSurvivalRecord.retention_before: NDArray[float64]#
ContinuousSurvivalRecord.weight_floor: float#
ContinuousSurvivalRecord.retention_at_time: NDArray[float64]#