simHCE {hce} | R Documentation |
Simulate hce
object with given event rates of time-to-event outcomes (Weibull), mean and SD of the continuous outcome (normal or log-normal) by treatment group
Description
Simulate hce
object with given event rates of time-to-event outcomes (Weibull), mean and SD of the continuous outcome (normal or log-normal) by treatment group
Usage
simHCE(
n,
n0 = n,
TTE_A,
TTE_P,
CM_A,
CM_P,
CSD_A = 1,
CSD_P = 1,
fixedfy = 1,
yeardays = 360,
pat = 100,
shape = 1,
logC = FALSE,
seed = NULL
)
Arguments
n |
sample size in the active treatment group. |
n0 |
sample size in the placebo group. |
TTE_A |
event rates per year in the active group for the time-to-event outcomes. |
TTE_P |
event rates per year in the placebo group for the time-to-event outcomes. Should have the same length as |
CM_A |
mean value for the continuous outcome of the active group. |
CM_P |
mean value for the continuous outcome of the placebo group. |
CSD_A |
standard deviation for the continuous outcome of the active group. |
CSD_P |
standard deviation for the continuous outcome of the placebo group. |
fixedfy |
length of follow-up in years. |
yeardays |
number of days in a year. |
pat |
scale of provided event rates (per |
shape |
shape of the Weibull distribution for time-to-event outcomes. Default is exponential distribution with |
logC |
logical, whether to use log-normal distribution for the continuous outcome. |
seed |
the seed for generating random numbers. |
Value
an object of class hce
containing the following columns:
ID subject identifier.
TRTP planned treatment group - "A" for active, "P" for Placebo.
GROUP type of the outcome, either "TTE" for time-to-event outcomes or "C" for continuous. Only one continuous outcome is possible, but no restriction on the number of "TTE" outcomes.
GROUPN order of outcomes in
GROUP
, with a higher value signifying a better outcome.AVALT the timing of the time-to-event outcomes.
AVAL0 numeric values of the continuous outcome and the timing of "TTE" outcomes.
AVAL analysis values derived as
AVAL0 + GROUPN
. For the continuous outcome the values ofAVAL0
are shifted to start always from 0.seed the seed of the random sample. If not specified in
seed
argument will be selected based on system time.PADY primary analysis day, the length of fixed follow-up in days calculated as
yeardays
multiplied byfixedfy
.
See Also
hce()
, as_hce()
for the helper a coerce function to hce objects.
Examples
# Example 1
Rates_A <- c(1.72, 1.74, 0.58, 1.5, 1)
Rates_P <- c(2.47, 2.24, 2.9, 4, 6)
dat <- simHCE(n = 2500, TTE_A = Rates_A, TTE_P = Rates_P,
CM_A = -3, CM_P = -6, CSD_A = 16, CSD_P = 15, fixedfy = 3)
head(dat)
# Example 2
Rates_A <- 10
Rates_P <- 15
dat <- simHCE(n = 1000, n0 = 500, TTE_A = Rates_A, TTE_P = Rates_P,
CM_A = 0.1, CM_P = 0, seed = 5, shape = 0.2, logC = TRUE)
summaryWO(dat)