# Translate group sequential design to integer events (survival designs) or sample size (other designs)

Source:`R/toInteger.R`

`toInteger.Rd`

Translate group sequential design to integer events (survival designs) or sample size (other designs)

## Arguments

- x
An object of class

`gsDesign`

or`gsSurv`

.- ratio
A non-negative integer, usually corresponding to experimental:control sample size ratio. Rounding is done to a multiple of

`ratio + 1`

. If input`x`

has class`gsSurv`

(design for time-to-event outcome), and`x$ratio`

is a whole number,`ratio`

is replaced by`x$ratio`

. See details.- roundUpFinal
Final value in returned

`n.I`

is rounded up if`TRUE`

; otherwise, just rounded. For`gsSurv`

input, final total sample size is also controlled by this. See details.

## Value

Output is an object of the same class as input `x`

; i.e., `gsDesign`

with integer vector for `n.I`

or `gsSurv`

with integer vector `n.I`

and integer total sample size. See details.

## Details

If `ratio = 3`

, rounding for final sample size is done to a multiple of 3 + 1 = 4.
For a `gsSurv`

object input in `x`

, event counts output in `n.I`

are rounded to nearest integer and
final total sample size is rounded to a multiple of `ratio + 1`

.
For other input values of `x`

(`gsDesign`

class), `n.I`

is interpreted as sample size;
final value is rounded to a multiple of `ratio + 1`

, with `roundUpFinal`

controlling rounding of last value.

## Examples

```
# The following code derives the group sequential design using the method
# of Lachin and Foulkes
x <- gsSurv(
k = 3, # 3 analyses
test.type = 4, # Non-binding futility bound 1 (no futility bound) and 4 are allowable
alpha = .025, # 1-sided Type I error
beta = .1, # Type II error (1 - power)
timing = c(0.45, 0.7), # Proportion of final planned events at interims
sfu = sfHSD, # Efficacy spending function
sfupar = -4, # Parameter for efficacy spending function
sfl = sfLDOF, # Futility spending function; not needed for test.type = 1
sflpar = 0, # Parameter for futility spending function
lambdaC = .001, # Exponential failure rate
hr = 0.3, # Assumed proportional hazard ratio (1 - vaccine efficacy = 1 - VE)
hr0 = 0.7, # Null hypothesis VE
eta = 5e-04, # Exponential dropout rate
gamma = 10, # Piecewise exponential enrollment rates
R = 16, # Time period durations for enrollment rates in gamma
T = 24, # Planned trial duration
minfup = 8, # Planned minimum follow-up
ratio = 3 # Randomization ratio (experimental:control)
)
# Convert bounds to exact binomial bounds
toInteger(x, ratio = 3)
#> Time to event group sequential design with HR= 0.3
#> Non-inferiority design with null HR= 0.7
#> Randomization (Exp/Control): ratio= 3
#> Asymmetric two-sided group sequential design with
#> 90 % power and 2.5 % Type I Error.
#> Upper bound spending computations assume
#> trial continues if lower bound is crossed.
#>
#> ----Lower bounds---- ----Upper bounds-----
#> Analysis N Z Nominal p Spend+ Z Nominal p Spend++
#> 1 31 0.07 0.5277 0.0141 2.83 0.0023 0.0023
#> 2 48 1.11 0.8673 0.0345 2.52 0.0059 0.0047
#> 3 69 2.00 0.9774 0.0514 2.00 0.0226 0.0179
#> Total 0.1000 0.0250
#> + lower bound beta spending (under H1):
#> Lan-DeMets O'Brien-Fleming approximation spending function (no parameters).
#> ++ alpha spending:
#> Hwang-Shih-DeCani spending function with gamma = -4.
#>
#> Boundary crossing probabilities and expected sample size
#> assume any cross stops the trial
#>
#> Upper boundary (power or Type I Error)
#> Analysis
#> Theta 1 2 3 Total E{N}
#> 0.0000 0.0023 0.0047 0.0159 0.0230 41.5
#> 0.4065 0.2863 0.3402 0.2762 0.9027 49.7
#>
#> Lower boundary (futility or Type II Error)
#> Analysis
#> Theta 1 2 3 Total
#> 0.0000 0.5277 0.3439 0.1054 0.9770
#> 0.4065 0.0141 0.0345 0.0487 0.0973
#> T n Events HR futility HR efficacy
#> IA 1 15.22419 8624.502 31 0.680 0.217
#> IA 2 19.23447 9064.000 48 0.483 0.302
#> Final 24.19069 9064.000 69 0.401 0.401
#> Accrual rates:
#> Stratum 1
#> 0-16 566.5
#> Control event rates (H1):
#> Stratum 1
#> 0-Inf 0
#> Censoring rates:
#> Stratum 1
#> 0-Inf 0
```