Skip to content

Commit

Permalink
Add missing calculation of weight loss
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Dunning authored and Mark Dunning committed Feb 16, 2024
1 parent 2c63096 commit 564e704
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions practical-noSolutions.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,11 @@ The *null hypothesis* for such a test would be that the weight loss is the same

```{r}
diet %>%
mutate(weight.loss = initial.weight - final.weight) %>%
ggdensity("weight.loss",color = "gender") + stat_overlay_normal_density()
diet %>%
mutate(weight.loss = initial.weight - final.weight) %>%
group_by(gender) %>%
shapiro_test(weight.loss)
Expand All @@ -562,6 +564,7 @@ This function allows various type of test to be performed by changing the approp

```{r}
diet %>%
mutate(weight.loss = initial.weight - final.weight) %>%
t_test(weight.loss ~ gender)
```

Expand All @@ -572,6 +575,7 @@ We can see that the t-statistic we observe is consistent with the null hypothesi

```{r}
diet %>%
mutate(weight.loss = initial.weight - final.weight) %>%
ggplot(aes(x = gender, y=weight.loss)) + geom_boxplot() + stat_compare_means(method="t.test")
```

Expand Down

0 comments on commit 564e704

Please sign in to comment.