generate_realistic_data: Realistic synthetic data generator and functions generator

View source: R/synthetic_data.R

generate_realistic_dataR Documentation

Realistic synthetic data generator and functions generator

Description

Generates a realistic dataset simulating treatment assignment, covariates, and potential outcomes.

Usage

generate_realistic_data(
  n,
  ncov = 5L,
  scenario_mu = "Realistic",
  scenario_nu = "Realistic",
  is_RCT = FALSE,
  seed = NA
)

Arguments

n

Number of observations to generate.

ncov

Number of baseline covariates (at least 2L and 10L by default).

scenario_mu

String indicating the type of scenario for delta_Mu ("Linear", "Threshold", "Mix", "Null", "Constant").

scenario_nu

String indicating the type of scenario for delta_Nu ("Linear", "Threshold", "Mix", "Satisfied").

is_RCT

Logical value indicating whether the scenario is an RCT (FALSE by default).

seed

Integer or NA (NA by default).

Value

A list containing two data frames (df_complete with all potential outcomes and treatment assignments and df_obs with observed outcomes based on treatment) and the oracular functions delta_Mu and delta_Nu.

Examples

data <- generate_realistic_data(100)
head(data[[1]])  # complete data
head(data[[2]])  # observed data

PLUCR documentation built on March 30, 2026, 5:08 p.m.