estimate_ipwhr.Rdestimate_ipwhr is a function that estimates the hazard ratio for a
treatment with a right-censored outcome using inverse-probablity weighted
estimation. Weights can be constructed to account for unequal treatment
probabilities.
estimate_ipwhr(
data,
models,
wt = NULL,
tau = NULL,
labels = NULL,
subgroup = NULL,
subgroup_ps = TRUE,
wt_type = "i",
trim = NULL,
trunc = NULL,
nboot = 0,
seed = 100,
continuous = TRUE,
ref = NULL
)The input data frame
A model_specification object describing the incoming
data, including the names of the variables containing the outcome (as a
time-to-event), treatment, censoring, and associated models. The outcome
and censoring times should be NA if they are censored). If no
identify_missing statement was included in the
model_specification, the estimator will default to a complete-case
(listwise deletion) analysis. The model specification is not allowed to
include identify_competing because estimate_ipwhr does not
currently support competing risks.
An optional vector of pre-computed weights to be applied to the analysis
Either NULL or a positive numeric value indicating a point at
which all data will be considered to be censored. Thus if tau is
non-NULL and a subject has an observed event or censoring time that
occurs after tau then they will be considered to have been censored at
tau. When tau is NULL, then no artificial censoring is imposed.
vector of strings that are used to describe analysis, used for faceting
An expression indicating which observations to include in the analysis
A logical indicating whether the PS should be re-estimated within the subgroup (default = TRUE)
The type of confounding weight used, "i"=IPTW (default), "n"=IPTW normalized to sum to \(n\) in each treatment group, or a numeric indicating which group to use as a standard in an SMR weight.
A scalar value (between 0 and 0.5) providing the thresholds for symmetrical propensity score trimming. For example, trim = 0.01 will drop observations with propensity scores below to the 1st percentile and above the 99th percentile (default = NULL, no trimming).
A scalar value (between 0 and 1) providing the top percentile at
which to truncate confounding weights. For example, trunc = 0.99 will
truncate all weights above the 99th percentile, i.e., weights larger than
the 99th percentile will be set equal to the 99th percentile (default =
NULL, no truncation).
The number of bootstrap resamples to generate. Used only if post-estimation bootstrap is used.
A seed for the random number generator to ensure reproducibility of bootstrap replications
Requests continuous bootstrap weights from a Dirichlet versus discrete weights from a multinomial (default = TRUE)
Either NULL or a string specifying the category to use as the
reference for hazard ratios. When the value is NULL then the reference
category is the first level of the treatment variable if it is a factor, or
the category with the earliest name according to lexicographical order
otherwise.
An object that inherits from classes hr and ipw that
contains information about the estimated hazard ratio and IP weights. In
addition to the fields of an estimate_ipwrisk() object, it has a
main_model_cox_fit field holding the fitted coxph object for
the primary analysis and a main_model_data field holding the
survival analysis dataset that model was fit to, with one row per
trial. When
nboot >= 1, the returned object additionally inherits from class
boot_est and includes a boot_results field: a list of length
nboot where each element is a tibble with columns
group_label and hr. The per-subject weights of each
bootstrap replicate are not retained, so inspect_ipw_weights() returns
an empty bootstrap entry for the object.
The weights that the Cox PH model is fit with depend on the censoring
model. When the censoring model is covariate-adjusted, the model uses the
product of the bootstrap, treatment, missingness, and
inverse-probability-of-censoring weights, with the censoring weights
varying over follow-up. When there is no censoring model or it is
intercept-only, the model uses only the product of the bootstrap,
treatment, and missingness weights. In either case the per-subject weights
reported by inspect_ipw_weights() include the censoring weights even if
they are not used.
When a subject contributes several pseudo trials (see
identify_subject()), the Cox model pools the trials and its robust
variance estimate clusters on the subject id, so that a subject's trials
are not treated as independent. This remains an approximation because
the estimated weights are treated as known. Bootstrap confidence
intervals (nboot > 0), which resample subjects together with all of
their trials, are recommended for such designs.