calculate_weights {TrialEmulation} | R Documentation |
Calculate Inverse Probability of Censoring Weights
Description
Usage
calculate_weights(object, ...)
## S4 method for signature 'trial_sequence_ITT'
calculate_weights(object, quiet = FALSE)
## S4 method for signature 'trial_sequence_AT'
calculate_weights(object, quiet = FALSE)
## S4 method for signature 'trial_sequence_PP'
calculate_weights(object, quiet = FALSE)
Arguments
object |
A trial_sequence object |
... |
Other arguments used by methods. |
quiet |
Prints model summaries is |
Value
A trial_sequence object with updated censor_weights
and/or switch_weights
slots
Examples
save_dir <- file.path(tempdir(), "switch_models")
ts <- trial_sequence("PP") |>
set_data(
data = data_censored,
id = "id",
period = "period",
treatment = "treatment",
outcome = "outcome",
eligible = "eligible"
) |>
set_switch_weight_model(
numerator = ~ age + x1 + x3,
denominator = ~age,
model_fitter = stats_glm_logit(save_path = save_dir)
) |>
calculate_weights()
[Package TrialEmulation version 0.0.4.0 Index]