simobs: Simulate Observed Data

Description Usage Arguments Value See Also

View source: R/simulation.r


This function simulates observed data from a DAG object.


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



A DAG objects that has been locked with set.DAG(DAG). Observed data from this DAG will be simulated.


Number of observations to sample.


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


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.


Seed for the random number generator.


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.


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


A data.frame where each column is sampled from the conditional distribution specified by the corresponding DAG object node.

See Also

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

Other simulation functions: simfull, sim

osofr/simcausal documentation built on Jan. 6, 2019, 3:05 a.m.