sim_func1 is a function that simulates a data structure with two baseline Gaussian covariates, a dichotomous exposure, and two Weibul distirbuted counterfactual outcomes, two censoring variables, and a competing event indicator. The simulation allows for confounding and dependent censoring through appropriate settings of parameters.

sim_func1(
  p = 0.5,
  alpha1 = -1.5,
  gamma0.0 = 3,
  gamma0.1 = 3,
  gamma1 = log(1.2),
  gamma2 = log(3),
  eta0 = 2,
  eta1 = log(3),
  eta2 = log(3),
  eta3 = log(3),
  cr_prev = 0.5,
  n = 50000,
  seed = NULL,
  counterfact = FALSE,
  comp_risk = FALSE,
  second_cens = FALSE
)

Arguments

p

The prevalence of exposure

alpha1

A parameter governing the strength of the confounder (W1)-treatement relation

gamma0.0, gamma0.1

Intercepts in the counterfactual models

gamma1, gamma2

Slopes in front of W1 and W2 common to both counterfactual models

eta0, eta1, eta2, eta3

Parameters in the censoring model.

cr_prev

The prevelence of the competing event.

n

The size of the simulated dataset

seed

A random number seed.

counterfact

A flag indicating whether counterfactuals should be included in output

comp_risk

A flag indicating whether a competing risk indicator should be included in output

second_cens

A flag indicating whether a second censoring variable should be included in output

Value

A data frame (tibble) containing the simulated data.

Author

M. Alan Brookhart