Estimates the event rates and dispersion from unblinded interim data and calculates the required sample size to maintain power, assuming the planned treatment effect holds (or using the observed control rate).
Usage
unblinded_ssr(
data,
ratio = 1,
lambda1_planning,
lambda2_planning,
rr0 = 1,
power = 0.8,
alpha = 0.025,
accrual_rate,
accrual_duration,
trial_duration,
dropout_rate = 0,
max_followup = NULL,
event_gap = NULL
)Arguments
- data
A data frame containing the unblinded interim data. Must include columns
events(number of events),tte(total exposure/follow-up time), andtreatment(treatment group identifier, e.g., 1 for control, 2 for experimental). This is typically the output ofcut_data_by_date().- ratio
Planned allocation ratio (experimental / control). Default is 1.
- lambda1_planning
Planned event rate for the control group used in original calculation.
- lambda2_planning
Planned event rate for the experimental group used in original calculation.
- rr0
Rate ratio under the null hypothesis (lambda2/lambda1). Default is 1.
- power
Target power (1 - beta). Default is 0.8.
- alpha
One-sided significance level. Default is 0.025.
- accrual_rate
Vector of accrual rates (patients per unit time).
- accrual_duration
Vector of durations for each accrual rate. Must be same length as
accrual_rate.- trial_duration
Total planned duration of the trial.
- dropout_rate
Dropout rate (hazard rate). Default is 0.
- max_followup
Maximum follow-up time for any patient. Default is NULL (infinite).
- event_gap
Gap duration after each event during which no new events are counted. Default is NULL (no gap).
Value
A list containing:
- n_total_unblinded
Re-estimated total sample size using unblinded estimates.
- dispersion_unblinded
Estimated dispersion parameter (k) from unblinded data.
- lambda1_unblinded
Estimated control event rate from unblinded data.
- lambda2_unblinded
Estimated experimental event rate from unblinded data.
- info_fraction
Estimated information fraction at interim (unblinded information / target information).
- unblinded_info
Estimated statistical information from the unblinded interim data.
- target_info
Target statistical information required for the planned power.
Examples
interim <- data.frame(
events = c(1, 2, 1, 3),
tte = c(0.8, 1.0, 1.2, 0.9),
treatment = c("Control", "Control", "Experimental", "Experimental")
)
unblinded_ssr(
interim,
ratio = 1,
lambda1_planning = 0.5,
lambda2_planning = 0.3,
power = 0.8,
alpha = 0.025,
accrual_rate = 10,
accrual_duration = 12,
trial_duration = 18
)
#> Warning: iteration limit reached
#> Warning: iteration limit reached
#> $n_total_unblinded
#> (Intercept)
#> 10
#>
#> $dispersion_unblinded
#> [1] 1.428899e-05
#>
#> $lambda1_unblinded
#> (Intercept)
#> 1.666666
#>
#> $lambda2_unblinded
#> (Intercept)
#> 1.904767
#>
#> $info_fraction
#> [1] 0.0569915
#>
#> $unblinded_info
#> [1] 1.714243
#>
#> $target_info
#> [1] 30.07893
#>