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 = CSD_A,
  fixedfy = 1,
  yeardays = 360,
  pat = 100,
  shape = 1,
  theta = 1,
  logC = FALSE,
  seed = NULL,
  dec = 2,
  all_data = FALSE
)

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 TTE_A.

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 pat-years).

shape

shape of the Weibull distribution for time-to-event outcomes. Default is exponential distribution with shape = 1.

theta

Gumbel dependence coefficient of the Weibull distributions for time-to-event outcomes. Default is theta = 1 which assumes independence of time-to-event outcomes. Must be above or equal to 1.

logC

logical, whether to use log-normal distribution for the continuous outcome.

seed

for generating random numbers.

dec

decimal places for the continuous outcome used for rounding. The default is dec = 2.

all_data

logical, whether to return source datasets ADET (an event-time dataset for all time-to-event outcomes per patient) and BDS (a basic data structure for the continuous outcome for all patients).

Value

an object of class hce containing the following columns:

If all_data = TRUE, the function returns a list containing the hce dataset, along with its source datasets: ADET (an event-time dataset for all time-to-event outcomes per patient) and BDS (a basic data structure for the continuous outcome for all patients).

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, dec = 0)
summaryWO(dat)

# Example 3: Comparison of dependent and independent outcomes
Rates_A <- c(10, 20)
Rates_P <- c(20, 20)
dat1 <- simHCE(n = 2500, TTE_A = Rates_A, TTE_P = Rates_P, 
CM_A = -3, CM_P = -6, CSD_A = 15, fixedfy = 3, theta = 1, seed = 1)
dat2 <- simHCE(n = 2500, TTE_A = Rates_A, TTE_P = Rates_P, 
CM_A = -3, CM_P = -6, CSD_A = 15, fixedfy = 3, theta = 1.0001, seed = 1)
calcWO(dat1)
calcWO(dat2)

[Package hce version 0.8.0 Index]