Learn R Programming

TrialEmulation (version 0.0.4.2)

set_censor_weight_model: Set censoring weight model

Description

[Experimental]

Usage

set_censor_weight_model(
  object,
  censor_event,
  numerator,
  denominator,
  pool_models = NULL,
  model_fitter
)

# S4 method for trial_sequence set_censor_weight_model( object, censor_event, numerator, denominator, pool_models = c("none", "both", "numerator"), model_fitter = stats_glm_logit() )

# S4 method for trial_sequence_PP set_censor_weight_model( object, censor_event, numerator, denominator, pool_models = "none", model_fitter = stats_glm_logit() )

# S4 method for trial_sequence_ITT set_censor_weight_model( object, censor_event, numerator, denominator, pool_models = "numerator", model_fitter = stats_glm_logit() )

# S4 method for trial_sequence_AT set_censor_weight_model( object, censor_event, numerator, denominator, pool_models = "none", model_fitter = stats_glm_logit() )

Value

object is returned with @censor_weights set

Arguments

object

trial_sequence.

censor_event

string. Name of column containing censoring indicator.

numerator

A RHS formula to specify the logistic models for estimating the numerator terms of the inverse probability of censoring weights.

denominator

A RHS formula to specify the logistic models for estimating the denominator terms of the inverse probability of censoring weights.

pool_models

Fit pooled or separate censoring models for those treated and those untreated at the immediately previous visit. Pooling can be specified for the models for the numerator and denominator terms of the inverse probability of censoring weights. One of "none", "numerator", or "both" (default is "none" except when estimand = "ITT" then default is "numerator").

model_fitter

An object of class te_model_fitter which determines the method used for fitting the weight models. For logistic regression use stats_glm_logit().

Examples

Run this code
trial_sequence("ITT") |>
  set_data(data = data_censored) |>
  set_censor_weight_model(
    censor_event = "censored",
    numerator = ~ age_s + x1 + x3,
    denominator = ~ x3 + x4,
    pool_models = "both",
    model_fitter = stats_glm_logit(save_path = tempdir())
  )

Run the code above in your browser using DataLab