calc_study_duration {beastt}R Documentation

Calculate the Analysis Time Based on a Target Number of Events and/or Target Follow-up Time

Description

Calculate the Analysis Time Based on a Target Number of Events and/or Target Follow-up Time

Usage

calc_study_duration(
  study_time,
  observed_time,
  event_indicator,
  target_events = NULL,
  target_follow_up = NULL
)

Arguments

study_time

Vector of study times (accrual time + observed time)

observed_time

Vector of observed times (event time or censoring time)

event_indicator

Vector of boolean values (TRUE/FALSE or 1/0) indicating if the observed time value is an event or censoring time

target_events

Target number of events, where the analysis time is determined once this number of events is reached. Default is NULL, in which case target_follow_up must be specified.

target_follow_up

Target follow-up for each participant, where the analysis time is determined once each participant in the risk set is followed up for this amount of time (i.e., minimum follow-up time). Default is NULL, in which case target_events must be specified.

Details

This function calculates the analysis time for a study with a time-to-event endpoint for which the target number of events (target_events) and/or target follow-up time (target_follow_up) are specified. If only target_events is specified, the analysis will occur at the time when the target number of events has been reached. If only target_follow_up is specified, the analysis will occur once the last-enrolled participant who is still in the risk set has been followed up for this amount of time. If both target_events and target_follow_up are specified, the analysis time will be based on whichever occurs first.

Value

Time of analysis

Examples

library(dplyr)

# Determining analysis time by reaching a target number of events
ex_tte_df |> mutate(
  analysis_time = calc_study_duration(study_time = total_time, observed_time = y,
                                      event_indicator = event, target_events = 30)
)

# Determining analysis time by a target follow-up time
ex_tte_df |> mutate(
  analysis_time = calc_study_duration(study_time = total_time, observed_time = y,
                                      event_indicator = event, target_follow_up = 12)
)

# Or use both (whichever happens first)
ex_tte_df |> mutate(
  analysis_time = calc_study_duration(study_time = total_time, observed_time = y,
                                      event_indicator = event,
                                      target_events = 30, target_follow_up = 12)
)

[Package beastt version 0.0.3 Index]