cleverly.sensitivity.TimeBalanceRow#

class cleverly.sensitivity.TimeBalanceRow(diagnostic: str, exposure: str, exposure_node: int, exposure_time: float, covariate: str, covariate_node: int, distance: int, history: str, contrast: str, levels: str, n_units: int, mean_group: float, mean_rest: float, mean_group_weighted: float, mean_rest_weighted: float, spread: float, difference_unweighted: float, difference_weighted: float, smd_unweighted: float, smd_weighted: float, person_time_unweighted: float, person_time_weighted: float)[source]#

One covariate in one comparison of one diagnostic, within one stratum.

Parameters:
diagnostic{“confounding”, “feedback”, “censoring”, “joint”}

Which check the row belongs to (see BalanceOverTime).

exposurestr

What the groups differ by: a treatment column, "censoring at <time>", "eliminated causes at <time>", or "status known at <time>".

exposure_nodeint

The time point of the exposure, counted from one; for the rows read at a target time of a continuous-time fit, the target time’s position counted from one.

exposure_timefloat

The exposure’s time: the grid time of a node when the data has one, the target time of a continuous-time row, else exposure_node. 0.0 for a baseline treatment of a continuous-time fit.

covariatestr

The covariate’s column.

covariate_nodeint

The time point the covariate was measured at; 0 for a baseline covariate.

distanceint

How many time points separate the covariate from the exposure.

historystr

The earlier treatments the stratum shares, such as "A1 = 1, A2 = 0"; empty when there are none.

contraststr

The two groups compared, in words.

levelsstr

The two groups, without the node: "1 vs 0", which matches rows over time.

n_unitsint

The rows in the two groups.

mean_groupfloat

The covariate’s mean in the first group, with the data’s weights only.

mean_restfloat

Its mean in the other group, with the data’s weights only.

mean_group_weightedfloat

The first group’s mean under the diagnostic’s weights.

mean_rest_weightedfloat

The other group’s mean under those weights.

spreadfloat

The standard deviation both differences are divided by: the pooled standard deviation of the two groups in the stratum, before the diagnostic’s weights. nan when it is zero or a group has fewer than two rows.

difference_unweightedfloat

mean_group - mean_rest.

difference_weightedfloat

mean_group_weighted - mean_rest_weighted.

smd_unweightedfloat

The unweighted difference divided by spread.

smd_weightedfloat

The weighted difference divided by spread.

person_time_unweightedfloat

The stratum’s size with the data’s weights, which the averages weight the unweighted column by.

person_time_weightedfloat

The stratum’s size under the stabilized weights, which the averages weight the weighted column by.

Methods#

Attributes#

TimeBalanceRow.diagnostic: str#
TimeBalanceRow.exposure: str#
TimeBalanceRow.exposure_node: int#
TimeBalanceRow.exposure_time: float#
TimeBalanceRow.covariate: str#
TimeBalanceRow.covariate_node: int#
TimeBalanceRow.distance: int#
TimeBalanceRow.history: str#
TimeBalanceRow.contrast: str#
TimeBalanceRow.levels: str#
TimeBalanceRow.n_units: int#
TimeBalanceRow.mean_group: float#
TimeBalanceRow.mean_rest: float#
TimeBalanceRow.mean_group_weighted: float#
TimeBalanceRow.mean_rest_weighted: float#
TimeBalanceRow.spread: float#
TimeBalanceRow.difference_unweighted: float#
TimeBalanceRow.difference_weighted: float#
TimeBalanceRow.smd_unweighted: float#
TimeBalanceRow.smd_weighted: float#
TimeBalanceRow.person_time_unweighted: float#
TimeBalanceRow.person_time_weighted: float#