Produces the individual weights that are associated with each observed event present in the input data used to fit an IP weighted risk model represented as an ipw object. The weights are presented as a collection of event weights tables that are segregated according to whether the corresponding events were part of the "main result" or a bootstrap iteration and which treatment group (if applicable) the corresponding subject was a member of.

inspect_ipw_weights(ipw_fit, events_only = FALSE)

Arguments

ipw_fit

An ipw object

events_only

Either TRUE or FALSE specifying whether to only include subjects for whom a noncensored non-competing-risk event occurred before the latest input to times in the original IPW model fit call

Value

A named list with entries main and bootstrap.

  • The main entry is a length-1 named list with a name given by the string " " (i.e. a string with one space) if there were no treatment groups specified in the original IPW model fit call, otherwise it is a named list where the names are given by the names of the treatment groups (and hence the length of the list is equal to the number of treatment groups). Each element in the list contains an event weights table with a form that is described later in this section.

  • The bootstrap entry is an unnamed list with length equal to the number of bootstrap iterations specified in the original IPW model fit call. Each entry in the list has the same form as for the main entry

The event weights tables each have the following columns. The rows are ordered in such a way that for row k and row m such that k is less than m then the minimum of the event time or the censoring time associated with row k is no greater than the event time associated with row m.

  • id: the subject ID

  • event_time: the time at which a (possibly competing risk) event occurred. If no event was observed before the censoring time for a given subject then the corresponding entry is missing

  • censor_time: the time at which censoring was observed. In the case that an event occurred before censoring for a given subject then the corresponding entry is missing

  • competing_risk: whether a competing risk event occurred before censoring for each subject

  • weight_bootstrap: the bootstrap iteration weight associated with each subject

  • weight_treatment: the treatment weight associated with each subject

  • weight_noncensored: the censoring weight associated with each subject

  • weight_nonmissing: the missingness weight associated with each subject

  • weight_subject: the total weight associated with each subject. This is given by the product of weight_bootstrap, weight_treatment, weight_noncensored, and weight_nonmissing

  • weight_risk: the weight that each subject contributes to the overall risk estimate. If a given subject does not observe a non-competing-risk event before their censoring time then they contribute nothing (i.e. have an entry with a value of 0) to the risk estimate. Otherwise, the amount of risk that they contribute is equal to the subject's corresponding entry in weight_subject

  • weight_cumulative: the cumulative weight for the current entry and previously occurring entries. In more detail, the k-th entry in weight_cumulative is given by the sum of the first k entries of weight_total

  • cumulative_risk: the cumulative risk associated with the corresponding event or censoring time for each subject. In more detail, let k be a row in the subject weights table such that there are no other rows in the table after row k with the same subject time as for row k. Then the estimated probability that an subject occurs no later than the event or censoring time associated with row k is equal to the cumulative risk entry associated with row k. For some other row m such that there is another row in the table after row m with the same subject time as for row m then the corresponding cumulative risk entry is not useful

  • variance: the conservative variance estimate using the influence function for the cumulative risk estimate associated with the corresponding event or censoring time for each subject

Details

The event tables produced by inspect_event_weights are arranged at the top level according to whether the results correspond to the "main results" or to a bootstrap iteration. The main results refers to the results that are obtained without performing any reweighting of the input data, in contrast to the bootstrap iterations for which reweighting is performed. The main results are always produced, and there can be zero or more event tables corresponding to bootstrap iterations.

The event tables are further divided according to which treatment group, if applicable, each of the subjects belonged to. In the case that no treatment groups were specified in the original IPW model fit call then all of the events are included in the same event table corresponding to the appropriate main results or bootstrap iteration.

Note that when the input to events_only is TRUE then subjects that did not have an observed noncensored and non-competing-risk event before the largest input to times in the original IPW model fit call are not included in any of the event tables. Furthermore, if there are subjects with missing observations in any of the covariates for any of the nuisance models, if applicable, than such subjects are omitted from the table (such patients can optionally be accounted for through missingness weights).

There are four primary weights that are associated with each entry in a given event table:

  • The bootstrap iteration weights. For the main results these weights all have a value of 1. Otherwise these are the weights that are given to the subjects in an event table corresponding to a given bootstrap iteration

  • The treatment weights. These are the inverses of the estimated probabilities of belonging to the treatment associated with a given event table, if applicable. In the case that no treatment groups were specified in the original IPW model fit call then all of the weights have a value of 1

  • The censoring weights. These are the inverses of the estimated probabilities of not being censored by the time at which each event occurred or censoring occurred, whichever came first

  • The missingness weights. These are the inverses of the estimated probabilities of not having missing data among any of the covariates that are specified for any of the treatment model, censoring model, or outcome model, as applicable. If there is no missing data then these weights are all 1

Furthermore, for a patient to contribute towards the overall cumulative risk then they have to have observed a non-competing-risk event occurring before a censoring event.