create_test {simtrial}R Documentation

Create a cutting test function

Description

Create a cutting test function for use with sim_gs_n()

Usage

create_test(test, ...)

Arguments

test

A test function such as wlr(), maxcombo(), or rmst()

...

Arguments passed to the cutting test function

Value

A function that accepts a data frame of simulated trial data and returns a test result

See Also

sim_gs_n(), create_cut()

Examples

# Simulate trial data
trial_data <- sim_pw_surv()

# Cut after 150 events
trial_data_cut <- cut_data_by_event(trial_data, 150)

# Create a cutting test function that can be used by sim_gs_n()
regular_logrank_test <- create_test(wlr, weight = fh(rho = 0, gamma = 0))

# Test the cutting
regular_logrank_test(trial_data_cut)

# The results are the same as directly calling the function
stopifnot(all.equal(
  regular_logrank_test(trial_data_cut),
  wlr(trial_data_cut, weight = fh(rho = 0, gamma = 0))
))

[Package simtrial version 0.4.1 Index]