---
title: "Worksheet 6"
output:
  pdf_document: default
  html_notebook: default
---



## Author: Enter name of the author here

## Discussants: Enter the names of other people who you discussed this problem set with


$\\$


The purpose of this worksheet is to get comfortable calculating probabilities. While you do not necessarily need to use R to answer all these questions, please be sure to show your work (i.e., how you go the answers you did), and also use R Markdown to write up your answers in a nice looking format in this document.  




<!-- This R chunk sets some parameters that will be used in the rest of the document. -->
```{r message=FALSE, warning=FALSE, tidy=TRUE, echo = FALSE}
 library(knitr)
 # makes sure the code is wrapped to fit when it creats a pdf
 opts_chunk$set(tidy.opts=list(width.cutoff=60)) 
 set.seed(1)  # set the random number generator to always give the same sequence of random numbers
 require('dplyr')  # use the dplyr package to manipulate data frames
```


$\\$





**Exercise 1:** Please answer question 5.5 on page 150 from Teaching Statistics Using Baseball. 
```{r message=FALSE, warning=FALSE, tidy=TRUE}


 # a) The probability that no home runs hit

 # b) The probability that between 2 and 4 home runs were hit


# c) The probability that 1 or more home runs were hit PR(HR > 0)


# d) The most likely number of home runs (calculated empirically) is:


```

**Answers:**

a)  

b)  

c) 

d) 





$\\$





**Exercise 2:** Please answer question 5.8 on page 151 from Teaching Statistics Using Baseball. 
```{r message=FALSE, warning=FALSE, tidy=TRUE}

# a) The probability that there are no runners on base in a 1/2 inning:


# b) The probability that a team does not score any runs in an at bat is:


# c) If a team has one runner on base in a 1/2 inning, the probability they score is: 


# d) If a team has three runners on base, the probability that at least one run is scored is


```


**Answers:**

a) 

b) 

c)   

d) 





$\\$




**Exercise 3:** Please answer question 5.9 on page 152 from Teaching Statistics Using Baseball. 
```{r message=FALSE, warning=FALSE, tidy=TRUE}

# a) The probability that the 1999 Phillies had no runners on base in a 1/2 inning:



# b) The probability that the 1999 Phillies did not score any runs in an at bat was:


# c) If the 1999 Phillies had one runner on base in a 1/2 inning, the probability they scored was: 



# d) When the 1999 Phillies had three runners on base, the probability that they scored at least one run is:



```


**Answers:**

a.a) 

a.b) 

a.c) 

a.d)  

b) 





$\\$






**Exercise 4a:**  In class we discussed the probability model for David Ortiz hitting a home run. In this model we said that the probability of David Ortiz not hitting a home run for a given plate appearance was .95, i.e.,  Pr(X = 0) = .95 and the probability of David Ortiz hitting a home run was Pr(X = 1) = .05. For the first part of this question, write down the sample space of outcomes, and create a bar plot representation of the probability distribution (hint: use the c() function to create a vector of probabilities, and use the barplot() function to plot this vector). 
```{r message=FALSE, warning=FALSE, tidy=TRUE}



```


**Answers:**  





$\\$





**Exercise 4b** Now let's create a probability model for the number of home runs hit by David Ortiz in two consecutive plate appearances. What is the sample space for this probability distribution? Assume that each plate appearance is independent of each other, and use the multiplicative and additive rules to create the probability distribution of home runs for two consecutive plate appearances. Show how you derived your answer and plot the results. 
```{r message=FALSE, warning=FALSE, tidy=TRUE}




```


**Answers:**  





$\\$






**Exercise 4c** Now try creating probability model for the number of home runs hit by David Ortiz in three consecutive plate appearances. What is the sample space for this probability distribution? Again assume that each plate appearance is independent of each other, and use the multiplicative and additive rules to create the probability distribution of home runs the consecutive plate appearances. Show how you derived your answer and plot the results. 
```{r message=FALSE, warning=FALSE, tidy=TRUE}





```


**Answers:** 











