generate_all_data: Data simulated from a directed acyclic graph (DAG) model

View source: R/generate_all_data.R

generate_all_dataR Documentation

Data simulated from a directed acyclic graph (DAG) model

Description

Simulate data from a directed acyclic graph (DAG) model.

Usage

generate_all_data(
  n = 200,
  alpha_S = 0,
  beta_M = 0,
  tau_S = 1,
  alpha_vec = rep(1, 3),
  beta_vec = rep(1, 3),
  M.family = stats::gaussian(),
  Y.family = stats::gaussian(),
  sigma_M = 0.5,
  sigma_Y = 0.5
)

Arguments

n

a sample size

alpha_S

a parameter in mediator model M~S+X for S

beta_M

a parameter in outcome model Y~S+M+X for M

tau_S

a parameter in outcome model Y~S+M+X for S

alpha_vec

a parameter vector in mediator model M~S+X for X

beta_vec

a parameter vector in outcome model Y~S+M+X for X

M.family

an error distribution and link function to be used in the mediator model. See family for details of family functions. The default family is gaussian.

Y.family

an error distribution and link function to be used in the outcome model. See family for details of family functions. The default family is gaussian.

sigma_M

the variance of the error term in the mediator model M~S+X

sigma_Y

the variance of the error term in the outcome model Y~S+M+X

Value

A list with the following components:

S

exposure

M

mediator

Y

outcome

X

confounder

Examples

out <- generate_all_data(n = 200)
summary(out$S)
summary(out$M)
summary(out$Y)
summary(out$X)


abima documentation built on Oct. 26, 2024, 1:08 a.m.