Step 1. Visualize the difference in means

library(tidyverse)
library(ggt.test)

‘Interlude’ - What if there was no relationship between vars - shuffling? Is difference consistent with no relationship?

In 10 shuffles, how many times is the difference under than observed diff 32.21…

data_haircuts |> 
  data_shuffle_var(var = price) |>  # shuffle - no association between vars
  ggplot() + 
  aes(x = shuffled) + #<< shuffled values 
  geom_stacks() +
  geom_mean() + 
  geom_mean_diff() +
  facet_align(sex) + 
  geom_mean_diff() +
  geom_mean_diff_label()


last_plot() + (data_haircuts |> data_shuffle_var(var = price))

last_plot() + (data_haircuts |> data_shuffle_var(var = price))

last_plot() + (data_haircuts |> data_shuffle_var(var = price))

last_plot() + (data_haircuts |> data_shuffle_var(var = price))

last_plot() + (data_haircuts |> data_shuffle_var(var = price))

Step 2. Visualize distribution for null (and standard error)

data_haircuts |> 
  count(sex)
##      sex  n
## 1 Female 37
## 2   Male 13
data_haircuts |> 
  group_by(sex) |>
  summarise(sd = sd(price))
## # A tibble: 2 × 2
##   sex       sd
##   <chr>  <dbl>
## 1 Female  41.6
## 2 Male    22.1