Skip to content

Commit

Permalink
docs: minor fix in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDenz1 committed Mar 3, 2024
1 parent ea02098 commit 637cdc8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 4 additions & 1 deletion TODOs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
19 changes: 18 additions & 1 deletion man/dag2matrix.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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)
}

0 comments on commit 637cdc8

Please sign in to comment.