Add spending time to `sim_gs_n`
@LittleBeannie is already working on this.
Since Jul 24, 2025.
- Dominant language
- R
- Stars
- 39
- Forks
- 14
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 7
Description
For group sequential designs, spending functions can be defined based on different fractions:
- information fraction (default)
- event fraction
- calendar time fraction
- minimal of planned and actual information fraction
The above 4 options is for interim analysis (IA). For final analysis (FA), there are 2 options:
- actual information fraction
- full alpha
To enable the above 8 options for a group sequential design, there are 2 proposed API.
**API proposal 1:**
```
sim_gs_n(
spending_time = c("info_frac", "event_frac", "time_frac", "min_planned_actual_info_frac"),
full_alpha_for_FA = TRUE,
....)
```
**API proposal 2:**
When specifying the spending time in `sim_gs_n()`, we may temporarily propose introducing a `create_spending()` function, similar to how we implemented `create_cut()`. For example:
```
create_spending_time <- function(actual_info = FALSE,
planned_info = FALSE,
actual_event = FALSE,
actual_time = FALSE){...}
```
Since the information fraction, event fraction, and calendar time fraction can vary between simulations, the spending function should be flexible to accommodate any combination of these inputs. The idea is to specify which of info, event, and time are used to define the spending.
Below is a draft illustrating this concept (please note the syntax and grammar are for illustration and may need refinement):
```
# spending by information fraction only (default)
# this is the same as API 1 when spending_time = "info_frac"
sim_gs_n(spending_time = create_spending_time(actual_info = TRUE),
full_alpha_for_FA = TRUE,
...)
# spending by event fraction only
# this is the same as API 1 when spending_time = "event_frac"
sim_gs_n(spending = create_spending_time(actual_event = TRUE)
full_alpha_for_FA = TRUE,
...)
# spending by calendar time fraction only
# this is the same as API 1 when spending_time = "time_frac"
sim_gs_n(spending = create_spending_time(actual_time = TRUE)
full_alpha_for_FA = TRUE,
...)
# spending by min{event fraction, calendar time fraction}
# this is the same as API 1 when spending_time = "min_planned_actual_info_frac"
sim_gs_n(spending = create_spending_time(actual_info = TRUE, planned_info = TRUE)
full_alpha_for_FA = TRUE,
...)
```
Comments and thoughts are welcome!!!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.