at first, I want to see distribution from bootstrap.
use infer
set.seed(1)
gss %>%
specify(response = hours) %>%
# hypothesize(null = "point", mu = 40) %>%
generate(reps = 1000,type="bootstrap") %>%
calculate("mean") %>%
visualise()
use rsample
f<- function(x){
x %>%
pluck() %>%
analysis() %>%
summarise(hours=mean(hours)) %>%
unlist()
}
set.seed(1)
df <- gss %>%
bootstraps(1000)
tibble(hours=map_dbl(df$splits,f) ) %>%
ggplot(aes(x=hours))+
geom_histogram(color="white",bins=15)+
ggtitle("bootstrap distribution")
this two figure is same .
and next, I use this code.
set.seed(1)
gss %>%
specify(response = hours) %>%
hypothesize(null = "point", mu = 40) %>%
generate(reps = 1000,type="bootstrap") %>%
calculate("mean") %>%
visualise()
How do you create the data that under this distribution?
And where did the data created by generate () go?