SimulateData: Generate simulation data.

View source: R/sim.R

SimulateDataR Documentation

Generate simulation data.

Description

SimulateData creates simulation data set using specified input parameters. Output list is dat argument for fitting path coefficients and direct and indirect effects.

Usage

SimulateData(params)

Arguments

params

Simulation parameters (see SimpleSim for format)

Details

Output list used as dat argument for ComputePath and ComputEffectxx. Has named elements:

  • y : response vector of length n, either double or Surv object

  • mm : n x q mediator matrix

  • xx : n x p treamtment matrix

  • co : n x r matrix of confounders

  • path : p x q matrix of 0s and 1s denoting paths to be fit. path[i,j]=0 indicates a priori knowledge of no path xx[i] and mm[j]

  • family : 'gaussian', 'binomial', or 'cox' indicating whether a linear, logistic, or cox model should be fit with the y on xx,mm,co regression

Value

List containing simulation data.

Examples

set.seed(1234)
params <- SimpleSim()
dat <- SimulateData(params)

longjp/mediateR documentation built on May 24, 2023, 12:30 p.m.