library(infer)
gss_permute <-
tibble::as_tibble(gss) |>
dplyr::filter(!(is.na(sex) | is.na(college))) |>
dplyr::mutate(partyid = as.character(partyid)) |>
dplyr::filter(partyid %in% c("ind", "rep", "dem"))|>
specify(college ~ sex, success = "no degree") |>
hypothesize(null = "independence") |>
generate(reps = 100, type = "permute") |>
calculate(stat = "z", order = c("female", "male"))
gss_permute |> visualize(method = "simulation")

gss_permute |> visualize(method = "simulation") + shade_confidence_interval(NULL)
#> list()
Created on 2025-12-12 with reprex v2.1.1
Same goes for shade_p_value().
Created on 2025-12-12 with reprex v2.1.1
Same goes for
shade_p_value().