Computes p-values for the MaxCombo test based on output from fh_weight()
.
This is still in an experimental stage and is intended for use with
the sim_fixed_n()
trial simulation routine.
However, it can also be used to analyze clinical trial data such as
that provided in the ADaM ADTTE format.
Usage
pvalue_maxcombo(
z,
algorithm = mvtnorm::GenzBretz(maxpts = 50000, abseps = 1e-05)
)
Arguments
- z
A dataset output from
fh_weight()
; see examples.- algorithm
This is passed directly to the
algorithm
argument inmvtnorm::pmvnorm()
.
Examples
library(dplyr)
# Example 1
x <- sim_fixed_n(
n_sim = 1,
timing_type = 5,
rho_gamma = data.frame(
rho = c(0, 0, 1),
gamma = c(0, 1, 1)
)
)
#> Backend uses sequential processing.
#> Loading required package: foreach
#> Loading required package: future
#>
#> Attaching package: ‘future’
#> The following object is masked from ‘package:survival’:
#>
#> cluster
head(x)
#> event ln_hr rho gamma z v1 v2 v3
#> 1 374 -0.3782851 0 0 -3.644545 1.0000000 0.8560315 0.9357919
#> 2 374 -0.3782851 0 1 -3.982620 0.8560315 1.0000000 0.9264503
#> 3 374 -0.3782851 1 1 -4.286398 0.9357919 0.9264503 1.0000000
#> cut duration sim
#> 1 Max(min follow-up, event cut) 76.61183 1
#> 2 Max(min follow-up, event cut) 76.61183 1
#> 3 Max(min follow-up, event cut) 76.61183 1
pvalue_maxcombo(x)
#> [1] 1.208958e-05
# Example 2
# Only use cuts for events, events + min follow-up
xx <- sim_fixed_n(
n_sim = 100,
timing_type = 5,
rho_gamma = data.frame(
rho = c(0, 0, 1),
gamma = c(0, 1, 1)
)
)
#> Backend uses sequential processing.
head(xx)
#> event ln_hr rho gamma z v1 v2 v3
#> 1 370 -0.5559926 0 0 -5.316363 1.0000000 0.8534282 0.9331543
#> 2 370 -0.5559926 0 1 -4.896380 0.8534282 1.0000000 0.9254183
#> 3 370 -0.5559926 1 1 -4.947177 0.9331543 0.9254183 1.0000000
#> 4 364 -0.1971851 0 0 -1.876825 1.0000000 0.8553223 0.9351107
#> 5 364 -0.1971851 0 1 -2.413346 0.8553223 1.0000000 0.9281533
#> 6 364 -0.1971851 1 1 -2.488439 0.9351107 0.9281533 1.0000000
#> cut duration sim
#> 1 Max(min follow-up, event cut) 72.63732 1
#> 2 Max(min follow-up, event cut) 72.63732 1
#> 3 Max(min follow-up, event cut) 72.63732 1
#> 4 Max(min follow-up, event cut) 74.87902 2
#> 5 Max(min follow-up, event cut) 74.87902 2
#> 6 Max(min follow-up, event cut) 74.87902 2
# MaxCombo power estimate for cutoff at max of targeted events, minimum follow-up
p <- xx |>
group_by(sim) |>
group_map(~ pvalue_maxcombo(.x)) |>
unlist()
mean(p < .025)
#> [1] 0.96