simfull: Simulate Full Data (From Action DAG(s))

View source: R/simulation.r

simfullR Documentation

Simulate Full Data (From Action DAG(s))

Description

This function simulates full data based on a list of intervention DAGs, returning a list of data.frames.

Usage

simfull(
  actions,
  n,
  wide = TRUE,
  LTCF = NULL,
  rndseed = NULL,
  rndseed.reset.node = NULL,
  verbose = getOption("simcausal.verbose")
)

Arguments

actions

Actions specifying the counterfactual DAG. This argument must be either an object of class DAG.action or a list of DAG.action objects.

n

Number of observations to sample.

wide

A logical, if TRUE the output data is generated in wide format, if FALSE, the output longitudinal data in generated in long format

LTCF

If forward imputation is desired for the missing variable values, this argument should be set to the name of the node that indicates the end of follow-up event. See the vignette, sim and doLTCF for additional details.

rndseed

Seed for the random number generator.

rndseed.reset.node

When rndseed is specified, use this argument to specify the name of the DAG node at which the random number generator seed is reset back to NULL (simulation function will call set.seed(NULL)). Can be useful if one wishes to simulate data using the set seed rndseed only for the first K nodes of the DAG and use an entirely random sample when simulating the rest of the nodes starting at K+1 and on. The name of such (K+1)th order DAG node should be then specified with this argument.

verbose

Set to TRUE to print messages on status and information to the console. Turn this off by default using options(simcausal.verbose=FALSE).

Value

A named list, each item is a data.frame corresponding to an action specified by the actions argument, action names are used for naming these list items.

See Also

simobs - a wrapper function for simulating observed data only; sim - a wrapper function for simulating both types of data; doLTCF for forward imputation of the missing values in already simulating data; DF.to.long, DF.to.longDT - converting longitudinal data from wide to long formats.

Other simulation functions: simobs(), sim()


simcausal documentation built on Oct. 29, 2022, 1:13 a.m.