# generate a null distribution by taking 200 bootstrap samples
gss |>
specify(response = hours) |>
hypothesize(null = "point", mu = 40) |>
generate(reps = 200, type = "bootstrap")
# generate a null distribution for the independence of
# two variables by permuting their values 200 times
gss |>
specify(partyid ~ age) |>
hypothesize(null = "independence") |>
generate(reps = 200, type = "permute")
# generate a null distribution via sampling from a
# binomial distribution 200 times
gss |>
specify(response = sex, success = "female") |>
hypothesize(null = "point", p = .5) |>
generate(reps = 200, type = "draw") |>
calculate(stat = "z")
# more in-depth explanation of how to use the infer package
if (FALSE) {
vignette("infer")
}
Run the code above in your browser using DataLab