weight_model_data_indices {TrialEmulation} | R Documentation |
Data used in weight model fitting
Description
Usage
weight_model_data_indices(
object,
type = c("switch", "censor"),
model,
set_col = NULL
)
Arguments
object |
A trial_sequence object |
type |
Select a censoring or switching model |
model |
The model name |
set_col |
A character string to specifying a new column to contain indicators for observations used in fitting this model. |
Value
If set_col
is not specified a logical data.table
column is returned. Otherwise
Examples
trial_pp <- trial_sequence("PP") |>
set_data(data_censored) |>
set_switch_weight_model(
numerator = ~age,
denominator = ~ age + x1 + x3,
model_fitter = stats_glm_logit(tempdir())
) |>
calculate_weights()
ipw_data(trial_pp)
show_weight_models(trial_pp)
# get logical column for own processing
i <- weight_model_data_indices(trial_pp, "switch", "d0")
# set column in data
weight_model_data_indices(trial_pp, "switch", "d0", set_col = "sw_d0")
weight_model_data_indices(trial_pp, "switch", "d1", set_col = "sw_d1")
ipw_data(trial_pp)
[Package TrialEmulation version 0.0.4.0 Index]