New Features
link argument tonode_gaussian(),node_binomial(),node_poisson(),node_negative_binomial() andnode_zeroinfl() to allow different link functions whengenerating data from these nodes.as.dagitty.DAG() function to allow directconversion ofDAG objects todagittyobjects.Bug Fixes
sim_n_datasets() function usedstats::runif(1) as a default for theseedargument. Because seeds are coerced to integers inset.seed(), this essentially meant theseedargument was always set to 0 (unless changed by the user), which was notintended. We changed the default to beNULL, which isequivalent to not setting aseed. This might change resultsobtained using previous versions. To get the same result as in previousversions, useseed=0 orseed=stats::runif(1).node() ornode_td() inside a function with objects passed toparents orformula.Documentation
New Features
network(),network_td() andnet() functions to allow simulations with network baseddependencies among individuals. This includes static and dynamicnetworks in regularDAGs and discrete-timesimulations.Enhancements
kind argument tonode_identity()to allow different kinds of input to theformulaargument.include_networks argument todag2matrix() andas.igraph(), due to the newnetworks-based simulation features.unif argument tonode_time_to_event() to allow users to generate multipletime-to-event nodes at once that are basically using the same “seed”value for the random number generator.Bug Fixes
node + DAG(in this order).formula with just one predictor in nodes that do not needan intercept.formula withnode_identity() insim_discrete_time().Documentation
Documentation
Enhancements
remove_vars argument to thesim2data() function, to allow users to exclude certainvariables from the output if desired.Bug Fixes
sim_n_datasets() would fail withn_cores > 1 whenever nested custom functions were usedin nodes.Documentation
node_custom documentation page has beenturned into a vignette (which it should have been from the start).New Features
formula interface ofnode() andnode_td() when using nodes of type"gaussian","binomial" or"poisson".node_aftreg(),node_ahreg(),node_poreg(),node_ypreg(),node_ehreg(),node_zeroinfl() andnode_mixture().Enhancements
reference argument torbernoulli() andrcategorical() to make iteasier to specify the reference category when coding the output as afactor variable.+.DAG now checks whether theDAG wouldbecome cyclic when adding anode() and returns an error ifit does.include_td_nodes andinclude_root_nodes arguments toas.igraph.DAG().n_cores in thesim_n_datasets() function to 1 fromparallel::detectCores()cens_dist argument in thenode_cox() function is now allowed.as_two_cols was added to thenode_cox() function to allow users to return only thetime-to-event as a single column if no censoring is applied.Bug Fixes
data.frame-like object with more than onecolumn.exp() call did not show up when the node wasdefined using theformula argument.Documentation
Bug Fixes
print.DAG()data.tableEnhancements
eval() calls.remove_not_at_risk argument to thesim2data() function.t0_sort_dag insim_discrete_time() fromTRUE toFALSE for more consistency withsim_from_dag().Bug Fixes
sim2data() with time-dependent nodes of typenode_competing_events() no longer results in an unwarrantederror message."time" in thetimeargument oflong2start_stop() now works properly.New Features
node_identity() function to allow users todirectly calculate nodes as an R expression of other nodes without theneed to define a new function.Documentation
Enhancements
output argument to therbernoulli() function to allow different outputformats.sort_dag insim_from_dag() fromTRUE toFALSE.coerce2factor andcoerce2numeric arguments inrcategorical(),node_multinomial() andnode_binomial() to theoutput argument for a more consistent syntax and easierusage.type argument innode() andnode_td().layout function inplot.DAG() is now supported.Bug Fixes
node_fill argument of theplot.DAG()function is no longer being ignored ifmark_td_nodes wasset toTRUE.New Features
formula argument. Standardformulas (without betas and intercepts) are still supported, but nolonger mentioned in the documentation and will be deprecated in futureversions.Documentation
node() function works.General
simDAG no longer listsdata.table under“Depends” in the description file. It is instead listed under “Imports”as recommended by thedata.table crewEnhancements
summary.DAG()andsummary.DAG.node()overlap argument to bothlong2start_stop() andsim2data() to directlycreate start-stop data with overlapping durations, as needed for somestatistical modelstarget_event andkeep_only_firstarguments tosim2data() and related functions, to allowdirect transformation into model-ready datasetlong2start_stop() function morecomputationally efficientBug Fixes
node_time_to_event() function, which printed an error whennot all arguments toprob_fun were supplied, even whenthese arguments had default valuesprint.DAG.node() which occurred when atime-to-event node with no parents was suppliedsim2data() which lead to inconsistentresults whenevent_duration=0 was used in one or more nodesof type “time_to_event” or “competing_events”. This made me realize thatevent durations smaller than 1 make no sense. They are now no longerallowed and the default of the node types has been changedaccordingly.formula objects of child nodesNew Features
as.igraph.DAG() method which extends thegeneric functionas.igraph() to conveniently parseDAG objects toigraph objectsas.data.table.simDT() andas.data.frame.simDT() for user convenienceDocumentation
Enhancements
node() andnode_td() now support charactervectors in the ‘name’ argument, allowing easy creation of multiple nodeswith the same definitionBug Fixes
node_time_to_event() functionthat lead to theimmunity_duration parameter being usedincorrectly. Since events were still recorded correctly, this was onlyapparent when usingsave_states="all". Works correctlynow.dag2matrix() if the dag objectcontained only root nodes. In this case, a logical matrix was returned.Now it returns the correct numeric matrix.New Features
sim_n_datasets() function to generatemultiple datasets from a single dag object, possibly using multicoreprocessingDocumentation