```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

\begin{center}
\textbf{THIS IS NOT THE ACTUAL MIDTERM EXAM}

This is only an example with one part and partial questions. The actual midterm will have two parts with 10 questions each. The instructions for the actual midterm will appear here. The purpose of this example is to get familiarized with the Rmd template and the exam format.
\end{center}

```{r message=FALSE}
library(tidyverse)
library(dplyr)
library(ggplot2)
library(gghighlight)
library(infer)
```

## I. That makes perfect cents!

*Which coin is unfair? Coin A or Coin B (or both)?*

You are given two unknown coins labeled A and B. Determine which one is an unfair coin. Note that the true probability of getting heads or tails for a fair coin is $P(H) = \frac{1}{2}$ (probability of heads) and $P(T) = \frac{1}{2}$ (probability of tails).

1. Load the `coins.csv` data set. This data set has two columns. The first column is the label of the coin and the second column is the outcome when flipping the coins. Determine the number of coin flips for each coin.

2. Generate some data where you flip a separate coin $n$ times where you know it is a fair coin. This generated data set will act as the control. Print out your generated data set.

3. Consider getting a tail as a "success". For each coin, what are the population parameters and what are the sample statistics?

4. For each of the coins, construct a null and alternative hypothesis where you take the difference in proportions against your control coin generated data. Consider getting a tail as a "success". Make sure to use mathematical symbols and its corresponding sentences.

5. Perform a hypothesis test with randomization for coin A. What is the point estimate(s) and the p-value? Plot your simulations. Make sure to label them properly and shade the appropriate region.

6. Perform a hypothesis test with randomization for coin B. What is the point estimate(s) and the p-value? Plot your simulations. Make sure to label them properly and shade the appropriate region.

7. For significance level of $\alpha=0.05$, make a decision for each coin and interpret the p-value.

8. What type of errors could you make in each of the coins? Explain your answer in the context of the problem.

9. Construct a 95\% confidence interval for coin A - considering an outcome of tails as "success" -  using Bootstrapping and percentiles. Interpret the interval in this context. Plot your simulations. Make sure to label them properly and indicate the interval in your plot.

10. Construct a 95\% confidence interval for coin B - considering an outcome of tails as "success" - using Bootstrapping and percentiles. Interpret the interval in this contex. Make sure to label them properly and indicate the interval in your plot. Make sure to label them properly and indicate the interval in your plot.

<br>
