Based off chapter 7 ModernDive. Code for quiz 11.
tactile_prop_red
# A tibble: 33 x 4
group replicate red_balls prop_red
<chr> <int> <int> <dbl>
1 Ilyas, Yohan 1 21 0.42
2 Morgan, Terrance 2 17 0.34
3 Martin, Thomas 3 21 0.42
4 Clark, Frank 4 21 0.42
5 Riddhi, Karina 5 18 0.36
6 Andrew, Tyler 6 19 0.38
7 Julia 7 19 0.38
8 Rachel, Lauren 8 11 0.22
9 Daniel, Caroline 9 15 0.3
10 Josh, Maeve 10 17 0.34
# ... with 23 more rows
ggplot(tactile_prop_red, aes(x = prop_red)) +
geom_histogram(binwidth = 0.05, boundary = 0.4, color = "white") +
labs(x = "Proportion of 50 balls that were red",
title = "Distribution of 33 proportions red")

#Segment 1
virtual_samples_26 <- bowl %>%
rep_sample_n(size = 2, reps = 1100)
#1.b
virtual_prop_red_26 <- virtual_samples_26 %>%
group_by(replicate) %>%
summarize(red = sum(color == "red")) %>%
mutate(prop_red = red / 26)
#1.c
ggplot(virtual_prop_red_26, aes(x = prop_red)) +
geom_histogram(binwidth = 0.05, boundary = 0.4, color = "white") +
labs(x = "Proportion of 26 balls that were red", title = "26")

#Segment 2
virtual_samples_57 <- bowl %>%
rep_sample_n(size = 57, reps = 1100)
#2.b
virtual_prop_red_57 <- virtual_samples_57 %>%
group_by(replicate) %>%
summarize(red = sum(color == "red")) %>%
mutate(prop_red = red / 57)
#2.c
ggplot(virtual_prop_red_57, aes(x = prop_red)) +
geom_histogram(binwidth = 0.05, boundary = 0.4, color = "white") +
labs(x = "Proportion of 57 balls that were red", title = "57")

#Segment 3
virtual_samples_110 <- bowl %>%
rep_sample_n(size = 110, reps = 1100)
#3.b
virtual_prop_red_110 <- virtual_samples_110 %>%
group_by(replicate) %>%
summarize(red = sum(color == "red")) %>%
mutate(prop_red = red / 110)
ggplot(virtual_prop_red_110, aes(x = prop_red)) +
geom_histogram(binwidth = 0.05, boundary = 0.4, color = "white") +
labs(x = "Proportion of 110 balls that were red", title = "110")

#Standard deviation of n=26
# A tibble: 1 x 1
sd
<dbl>
1 0.0266
#Standard deviation of n=57
# A tibble: 1 x 1
sd
<dbl>
1 0.0637
#standard deviation of n=110
# A tibble: 1 x 1
sd
<dbl>
1 0.0446