Skip to content

Commit 6057da5

Browse files
Small changes to motivation vignette
1 parent 318aaec commit 6057da5

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

vignettes/motivation.Rmd

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ Why another graph package in R? The `caugi` package was designed to provide a _f
2222
library(caugi)
2323
```
2424

25-
### Causality
25+
### Representation of causal graphs
2626

27-
Causal graphs are easy to draw and aid us in understanding causal mechanisms by visual representation. In R, representing them can feel clunky. We usually resort to adjacency matrices, edge lists, or packages like `igraph` or `graph`.
27+
Causal graphs are easy to draw and aid us in understanding causal mechanisms by visual representation. In R, representing them can feel clunky. Historically, users have resorted to adjacency matrices, edge lists, or packages like `igraph` or `graph`.
2828

29-
These packages are great and each have their strengths, but they are not built for _causal_ graphs, which often have special edge types and properties. This leads to situations such as representing undirected edges as two directed edges going in each direction, or representing PAG-type edges by opaque matrix formats, as seen in for example `pcalg`, where
29+
These tools are great and each have their strengths, but they are not built for _causal_ graphs, which often have special edge types and properties. This leads to situations such as representing undirected edges as two directed edges going in each direction, or representing PAG-type edges by opaque matrix formats, as seen in for example `pcalg`, where
3030

3131
```{r pcalg-pag}
3232
nodes <- c("A", "B", "C", "D", "E")
@@ -44,26 +44,32 @@ amat <- matrix(
4444
amat
4545
```
4646

47-
describes the graph
47+
represents the graph
4848

49-
```{r caugi-pag}
49+
```{r caugi-pag, eval=FALSE}
5050
caugi_graph(
5151
A %-->% B %o->% C %---% E,
5252
B %o-o% D %---% E,
5353
A %--o% E
5454
)
5555
```
5656

57-
Hopefully, it is clear what is easier to read.
57+
The second form reads like the picture in your head.
5858

59-
In general, for people working in causal inference and causal discovery, the lack of readable, well supported formats can lead to clunky, hacky code that is hard to read and maintain. `caugi` aims to fix this with a readable syntax, which mimics how we draw graphs in hand, and gives the user the ability to express complex causal relationships.
59+
For people working in causal inference and causal discovery, the lack of readable, well supported formats can lead to clunky, hacky code that is hard to read and maintain. `caugi` aims to fix this with a readable syntax, which mimics how we draw graphs in hand, and gives the user the ability to express complex causal relationships.
6060

6161
### Safety
6262

6363
When makeshift solutions are used to represent causal graphs, it leads to not only bugs, but confusion and wasted time. With `caugi` we aim to make causal graphs safe to work with, so you do not accidentally create invalid graphs, and so you can focus on the causal problems at hand, not on the representation.
6464

65+
We have ensured that `caugi` graph object it should not be possible to alter in such a way that the underlying graph class becomes valid. For example, creating a DAG with `caugi`, acyclicity is guaranteed by construction. Trying to add an edge that would create a cycle will throw an error.
66+
67+
More generally, all `caugi` aims to be __graph-class safe__. Think of it as type safety, but on a graph class level. This safety comes at some costs; if `caugi` doesn't support the graph type, you are using, then the graph class should be set to `"Unknown"`, and most operations will not be available. However, this is a small price to pay for safety and clarity. In `caugi`, we prefer clarity over silent misinterpretation.
68+
6569
We refer to the vignette `vignette("package_use")` to see how to (safely) use `caugi` in your package.
6670

6771
### Performance
6872

69-
Due to the underlying data structure of `caugi`, the graph objects are fast to query, but slower to initialize than other graph object types might be. The trade-off is favorable, as graphs are typically queried many times after being created once. This makes `caugi` suitable for large graphs, where performance matters. You can read more about performance in `vignette("performance")`.
73+
Due to the underlying data structure of `caugi`, the graph objects are fast to query, but slower to initialize than other graph object types might be. The trade-off is favorable, as graphs are typically queried many times after being created once. This makes `caugi` suitable for large graphs, where performance matters, but even for small graphs the performance gain is significant to other packages.
74+
75+
You can read more about the performance of `caugi` in `vignette("performance")`.

0 commit comments

Comments
 (0)