diff --git a/TODOs.txt b/TODOs.txt index ad42785..bac6a4c 100644 --- a/TODOs.txt +++ b/TODOs.txt @@ -4,6 +4,9 @@ sim2start_stop: - .last works now, but adds unneccessary columns if events of the same kind happen right after one another +sim_discrete_time: + - should include t = 0 in output (or an option for it) + ####### New Features: ####### sim_from_dag: @@ -26,4 +29,4 @@ sim2start_stop: - event_durations vector on line 101 needs to be changed to allow different event_durations per different event - the data.table on line 126 needs to include another column including the event type (cause) - probably need to change the dcast() call accordingly on line 133 - - instead of returning the condition directly on line 149/150, it should return the corresponding event + - instead of returning the condition directly on line 149/150, it should return the corresponding event \ No newline at end of file diff --git a/man/dag2matrix.Rd b/man/dag2matrix.Rd index 06d65f5..7baf3c5 100644 --- a/man/dag2matrix.Rd +++ b/man/dag2matrix.Rd @@ -12,7 +12,7 @@ dag2matrix(dag, include_root_nodes=TRUE, include_td_nodes=FALSE) } \arguments{ \item{dag}{ -A \code{DAG} object created using the \code{\link{empty_dag}} function with nodes added to it using the \code{+} syntax. See \code{?empty_dag} or \code{?node} for more details. Currently does not support DAGs with time-dependent nodes added using the \code{\link{node_td}} function. +A \code{DAG} object created using the \code{\link{empty_dag}} function with nodes added to it using the \code{+} syntax. See \code{?empty_dag} or \code{?node} for more details. Supports DAGs with time-dependent nodes added using the \code{\link{node_td}} function. However, including such DAGs may result in cyclic causal structures, because time is not represented in the output matrix. } \item{include_root_nodes}{ Whether to include root nodes in the output matrix. Should usually be kept at \code{TRUE} (default). @@ -50,6 +50,23 @@ dag <- empty_dag() + # get adjacency matrix dag2matrix(dag) +# get adjacency matrix using only the child nodes +dag2matrix(dag, include_root_nodes=FALSE) + +## adding time-varying nodes +dag <- dag + + node_td("disease", type="time_to_event", parents=c("age", "smoking"), + prob_fun=0.01) + + node_td("death", type="time_to_event", parents=c("age", "sex", "smoking", + "disease"), + prob_fun=0.001, event_duration=Inf) + +# get adjacency matrix including all nodes +dag2matrix(dag, include_td_nodes=TRUE) + +# get adjacency matrix including only time-constant nodes +dag2matrix(dag, include_td_nodes=FALSE) + # get adjacency matrix using only the child nodes dag2matrix(dag, include_root_nodes=FALSE) }