Generates synthetic outcome variable given covariate, effect modifier, and treatment variables.

generate_syn_data_outcome(
  cf,
  em,
  treat,
  outcome_sd = 1,
  em_spec = 1,
  heterogenous_intercept = FALSE,
  beta = 1
)

Arguments

cf

A data.frame of confounder variables

em

A data.frame of effect modifier variables

treat

A vector of treatment variable

outcome_sd

standard deviation of outcome variable

em_spec

specification of effect modifier function (possible values: 0, 1, 2)

  • em_spec == 0: no effect modification

  • em_spec == 1:independent effect modification of em1 and em2 (4 causal effect groups)

  • em_spec == 2 -> interactive effect modification of em1 and em2 (3 causal effect groups)

heterogenous_intercept

whether the intercept of the CRF should vary by effect modifier levels

beta

strength of effect modification (only effective if em_spec is 1 or 2)

Value

A data.frame of simulated data.

Examples


set.seed(41)
covariate_data <- generate_syn_data_covs(sample_size = 200,
                                         gps_spec = 1)