Learn R Programming

TrialEmulation (version 0.0.4.2)

set_outcome_model: Specify the outcome model

Description

[Experimental]

The time-to-event model for outcome is specified with this method. Any adjustment terms can be specified. For ITT and PP estimands the treatment_var is not specified as it is automatically defined as assigned_treatment. Importantly, the modelling of "time" is specified in this model with arguments for trial start time and follow up time within the trial.

Usage

set_outcome_model(object, ...)

# S4 method for trial_sequence set_outcome_model( object, treatment_var = ~0, adjustment_terms = ~1, followup_time_terms = ~followup_time + I(followup_time^2), trial_period_terms = ~trial_period + I(trial_period^2), model_fitter = stats_glm_logit(save_path = NA) )

# S4 method for trial_sequence_ITT set_outcome_model( object, adjustment_terms = ~1, followup_time_terms = ~followup_time + I(followup_time^2), trial_period_terms = ~trial_period + I(trial_period^2), model_fitter = stats_glm_logit(save_path = NA) )

# S4 method for trial_sequence_PP set_outcome_model( object, adjustment_terms = ~1, followup_time_terms = ~followup_time + I(followup_time^2), trial_period_terms = ~trial_period + I(trial_period^2), model_fitter = stats_glm_logit(save_path = NA) )

# S4 method for trial_sequence_AT set_outcome_model( object, treatment_var = "dose", adjustment_terms = ~1, followup_time_terms = ~followup_time + I(followup_time^2), trial_period_terms = ~trial_period + I(trial_period^2), model_fitter = stats_glm_logit(save_path = NA) )

Value

A modified object with the outcome_model slot set

Arguments

object

A trial_sequence object

...

Parameters used by methods

treatment_var

The treatment term, only used for "as treated" estimands. PP and ITT are fixed to use "assigned_treatment".

adjustment_terms

Formula terms for any covariates to adjust the outcome model.

followup_time_terms

Formula terms for followup_time, the time period relative to the start of the trial.

trial_period_terms

Formula terms for trial_period, the time period of the start of the trial.

model_fitter

A te_model_fitter object, e.g. from stats_glm_logit().

Examples

Run this code
trial_sequence("ITT") |>
  set_data(data_censored) |>
  set_outcome_model(
    adjustment_terms = ~age_s,
    followup_time_terms = ~ stats::poly(followup_time, degree = 2)
  )

Run the code above in your browser using DataLab