Simulation function {BuyseTest} | R Documentation |
Simulate binary, continuous or time to event data, possibly with strata. Outcomes are simulated independently of each other and independently of the strata variable.
simBuyseTest(n.T, n.C = NULL, argsBin = list(), argsCont = list(), argsTTE = list(), n.strata = NULL, names.strata = NULL, format = "data.table", latent = FALSE)
n.T |
[integer, >0] number of patients in the treatment arm |
n.C |
[integer, >0] number of patients in the control arm |
argsBin |
[list] arguments to be passed to |
argsCont |
[list] arguments to be passed to |
argsTTE |
[list] arguments to be passed to |
n.strata |
[integer, >0] number of strata. |
names.strata |
[character vector] name of the strata variables. Must have same length as |
format |
[character] the format of the output. Can be |
latent |
[logical] If |
This function is built upon the lvm
and sim
functions from the lava package.
Arguments in the list argsBin
:
p.T
probability of event of each endpoint (binary endpoint, treatment group).
p.C
same as p.T
but for the control group.
name
names of the binary variables.
Arguments in the list argsCont
:
mu.T
expected value of each endpoint (continuous endpoint, treatment group).
mu.C
same as mu.C
but for the control group.
sigma.T
standard deviation of the values of each endpoint (continuous endpoint, treatment group).
sigma.C
same as sigma.T
but for the control group.
name
names of the continuous variables.
Arguments in the list argsTTE
:
rates.T
hazard corresponding to each endpoint (time to event endpoint, treatment group).
rates.C
same as rates.T
but for the control group.
rates.Censoring
Censoring same as rates.T
but for the censoring.
name
names of the time to event variables.
nameCensoring
names of the event type indicators.
n <- 1e2 #### default option #### simBuyseTest(n) ## with a strata variable having 5 levels simBuyseTest(n, n.strata = 5) ## with a strata variable named grade simBuyseTest(n, n.strata = 5, names.strata = "grade") ## several strata variables simBuyseTest(1e3, n.strata = c(2,4), names.strata = c("Gender","AgeCategory")) #### only binary endpoints #### args <- list(p.T = c(3:5/10)) simBuyseTest(n, argsBin = args, argsCont = NULL, argsTTE = NULL) #### only continuous endpoints #### args <- list(mu.T = c(3:5/10), sigma.T = rep(1,3)) simBuyseTest(n, argsBin = NULL, argsCont = args, argsTTE = NULL) #### only TTE endpoints #### args <- list(rates.T = c(3:5/10), rates.Censoring = rep(1,3)) simBuyseTest(n, argsBin = NULL, argsCont = NULL, argsTTE = args)