## 1. Use sample() to obtain X_1, ..., X_N ~ Bernoulli(p = 0.25).
## Store your observations (unfair coin flips) into a variable named
## x, where N = 1001.
## 2. Use the variable x to approximate P(X = 1).
## 3. Since the Bernoulli distribution only allows 0, 1 values, do we
## need to use the logical operator ==? Repeat your code without ==,
## to ensure that you get the same estimate of the population
## parameter p.
## 3. Create a dataframe that holds x and a variable that indexes the
## coin flips. Name the dataframe df.
## Hint: ?data.frame
## 4. Using dplyr's function mutate() and the %>% operator to add a
## variable to df. The new variable should be the cumulative mean of
## the observations over the successive flips.
## Hint: ?dplyr::mutate
## 5. Use ggplot2's function ggplot(), along with geom_line(), to plot
## the flips on the x-axis and the cumulative mean on the y-axis.
## Hint: ?ggplot2::geom_line
## 6. Add to your plot above a horizontal line at the true probability
## of P(X = 1).
## Hint: ?geom_hline
## 7. Make a new plot, in similar spirit to the one above, using X_1,
## ..., X_N ~ Uniform(5, 20). This time, take the mean of the values
## the random variables take on, not P(X == z) for some value z. For
## instance, if N = 3 and you get 6, 14, 12, you'd calculate mean(c(6,
## 14, 12)).
## 8. Guess what value your (approximate) mean is converging to? Does
## this number seam reasonable given the values your data can take on?