simDAG 0.5.0
New Features
- Added the
sim_discrete_event()function, which allows users to perform discrete-event simulations to generate complex longitudinal data in continuous time. This function is usually much faster than comparablesim_discrete_time()calls, although at the cost of some flexibility. - Added the
rtexp()function to allow sampling from left-truncated exponential distributions. - Added the
rsample()function as a convenient wrapper aroundsample(), as suggested by Ed Hagen. - Added the
node_aalen()function to allow data to be generated according to an Aalen additive hazards model with time-constant betas and baseline hazard. - Added the
as_tidy_dagitty.DAG()method, which allows direct conversion ofDAGtotidy_dagittyobjects used to create plots in theggdagpackage.
Enhancements
- Added the
remove_ifandbreak_ifarguments to thesim_discrete_time()function, to allow users some options that potentially make the simulation much faster. - Allow function input to the
data_formatargument of thesim_n_datasets()function to avoid potentially weird bugs in parallel processing. - There was a slight change to
node_binomial(), which increases performance ifreturn_probs=TRUEis used (avoiding a needlessrbernoulli()call). The results of simulations with aDAGcontaining a node with bothtype="binomial"andreturn_probs=TRUEmight therefore differ on the same random number generator seed as compared to previous versions. - Made the
node_cox()function faster, added theleftargument to it to allow left-truncation and changed the default ofcens_disttoNULL. These changes likely result in different data being generated as compared to previous versions, even with the same random number generator seed. - Added the
formulaargument tonode_time_to_event()to allow users to easily calculate event probabilities from binomial regression models without having to specify aprob_fun. - Allow
DAG.nodedefinitions in thevaluesargument of thedo()function, to make changing existingDAGs easier.
Bug Fixes
- Fixed a bug where using
n_sim=1insim_from_dag()lead to a false error with some child node types. - Function calls on the
interceptpart of enhancedformulas are now supported correctly. Previously,formulas like~ log(0.1) + 2*Awould have resulted in a false error.
Documentation
- Small changes to include the new
sim_discrete_event()everywhere. - Added a new vignette introducing the
sim_discrete_event()function.