Skip to content

Commit 0445bb0

Browse files
committed
swap deprecated size arg for linewidth; remove duplicated summary chunk
1 parent 334cf06 commit 0445bb0

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

exercises/01-whole-game-exercises.qmd

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ Let's look at the distribution of weight gain between the two groups.
3636
```{r}
3737
nhefs_complete_uc |>
3838
ggplot(aes(wt82_71, fill = factor(qsmk))) +
39-
geom_vline(xintercept = 0, color = "grey60", size = 1) +
40-
geom_density(color = "white", alpha = .75, size = .5) +
39+
geom_vline(xintercept = 0, color = "grey60", linewidth = 1) +
40+
geom_density(color = "white", alpha = .75, linewidth = .5) +
4141
scale_color_okabe_ito(order = c(1, 5)) +
4242
theme_minimal() +
4343
theme(legend.position = "bottom") +
@@ -60,19 +60,6 @@ nhefs_complete_uc |>
6060
)
6161
```
6262

63-
---
64-
65-
```{r}
66-
# ~2.5 kg gained for quit vs. not quit
67-
nhefs_complete_uc |>
68-
group_by(qsmk) |>
69-
summarize(
70-
mean_weight_change = mean(wt82_71),
71-
sd = sd(wt82_71),
72-
.groups = "drop"
73-
)
74-
```
75-
7663
Here, it looks like those who quit smoking gained, on average, 2.5 kg. But is there something else that could explain these results? There are many factors associated with both quitting smoking and gaining weight; could one of those factors explain away the results we're seeing here?
7764

7865
To truly answer this question, we need to specify a causal diagram based on domain knowledge. Sadly, for most circumstances, there is no data-driven approach that consistently identify confounders. Only our causal assumptions can help us identify them. Causal diagrams are a visual expression of those assumptions linked to rigorous mathematics that allow us to understand what we need to account for in our model.

0 commit comments

Comments
 (0)