Skip to content

Commit

Permalink
move around dag intro
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmbarrett committed Oct 20, 2023
1 parent 1c9df26 commit 36ceb8b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions _freeze/chapters/chapter-05/execute-results/html.json

Large diffs are not rendered by default.

Binary file modified _freeze/chapters/chapter-05/figure-html/unnamed-chunk-13-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _freeze/chapters/chapter-05/figure-html/unnamed-chunk-14-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion chapters/chapter-05.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,16 @@ knitr::include_graphics("../images/podcast-diagram.png")

The main tool we'll use for making DAGs is ggdag. ggdag is a package that connects ggplot2, the most powerful visualization tool in R, to dagitty, an R package with sophisticated algorithms for querying DAGs.

To create a DAG object, we'll use the `dagify()` function. The `dagify()` function takes formulas, separated by commas, that specify causes and effects, with the left element of of the formula specifying the effect and the right all of the factors that cause it. This is just like the type of formula we specify for most regression models in R. `dagify()` returns a `dagitty` object that works with both the dagitty and ggdag packages.
To create a DAG object, we'll use the `dagify()` function.`dagify()` returns a `dagitty` object that works with both the dagitty and ggdag packages. The `dagify()` function takes formulas, separated by commas, that specify causes and effects, with the left element of of the formula specifying the effect and the right all of the factors that cause it. This is just like the type of formula we specify for most regression models in R.

```{r}
#| eval: false
dagify(
effect1 ~ cause1 + cause2 + cause3,
effect2 ~ cause1 + cause4,
...
)
```

What are all of the factors that cause graduate students to listen to a podcast the morning before an exam? What are all of the factors that could cause a graduate student to do well on a test? Let’s posit some here.

Expand Down

0 comments on commit 36ceb8b

Please sign in to comment.