Skip to contents

Generic summarise function for tests

Usage

summarise_test(alpha, name = NULL)

Arguments

alpha

the significance level(s)

name

name for the summarise function, appended to the name of the analysis method in the final results

Value

A function that can be used in Summarise that returns a data frame with the columns

  • rejection_X

  • rejection_Y

  • ...

Where X, Y, ... are the alpha levels given in the argument

Examples

# \donttest{
condition <- merge(
  assumptions_delayed_effect(),
  design_fixed_followup(),
  by=NULL
) |>
  tail(4) |>
  head(1)

summarise_all <- create_summarise_function(
  logrank=summarise_test(alpha=c(0.5, 0.9, 0.95, 0.99))
)

# runs simulations
sim_results <- runSimulation(
  design=condition,
  replications=100,
  generate=generate_delayed_effect,
  analyse=list(
    logrank=analyse_logrank()
  ),
  summarise = summarise_all
)
#> 
#> 
Design: 1/1;   RAM Used: 184 Mb;   Replications: 100;   Total Time: 0.00s 
#>  Conditions: delay=121., hzrd_c=0.0009, hzrd_t=0.0006, rndm_w=0.0001, n_trt=150, n_ctrl=150, follwp=730., rcrtmn=182.
#> 

#> 
#> Simulation complete. Total execution time: 1.57s

sim_results[, grepl("rejection", names(sim_results))]
#> # A tibble: 1 × 4
#>   logrank.rejection_0.5 logrank.rejection_0.9 logrank.rejection_0.95
#>                   <dbl>                 <dbl>                  <dbl>
#> 1                     1                     1                      1
#> # ℹ 1 more variable: logrank.rejection_0.99 <dbl>
# }