---
title: 'Section 3.4: Named Discrete Distributions - Student Notes'
output:
  pdf_document:
    toc: yes
    toc_depth: '1'
  html_document:
    theme: sandstone
    toc: yes
    toc_depth: 1
    toc_float: yes
    css: ../style.css
    highlight: tango
---

This RMD file is for you to use to follow along typing examples as you learn this material. 
This section contains a lot of LaTeX and R code, and so this provides a way for you to practice writing answers both in math, and in R together. This also allows you to copy/paste your answers into the tutorial once released. 

----

# Binomial Distribution (Speegle 3.3.1)

### Example:  
1. Plant 10 beet seeds, and assume that the germination of one seed is independent of the germination of another seed, and all seeds have a germination probability of $p$=.8. Let $X$ be the number of seeds that germinated. 


**Theoretical**

 

**Simulation**




2. A coin for which the probability of heads is .6 is tossed nine times. Find the probability of obtaining 3 heads. 


**by hand using the pmf**


**theoretical using R commands**


**using simulation**


3. 10 students are selected at random, each has a probability of 0.10 of being a Math major. What is the probability that at least one student is a math major? 


**by hand using the pmf**

**theoretical using R commands**



**simulation**



### You try it:  
1. A recent national study showed that approximately 45\% of college students binge drink.  Let $X$ equal the number of students in a random sample of size $n=12$ who binge drink. Using both the pmf by hand, and R commands, find the probability that

a. $X$ is at most 2.

b. $X$ is at least 1.

c. Use simulation to obtain the mean and variance of $X$. 


2. A certain electric system contains 10 components.  Suppose that the probability that each individual will fail is .2 and that the components fail independently of each other. **Given that at least one of the components failed**, what is the probability that at least two of the components have failed? Write this out mathematically and simplify _before_ you go to R. 


----

# Geometric Distribution (Speegle 3.3.2)

## Example: Free throwing
Professional basketball player Steve Nash was a 90% free throw shooter over his career. Answer the following questions using the formulas and also simulation. 

a. If Steve Nash starts shooting free throws, how many would he expect to make before missing one? 

**Theoretical**



**Simulation**



b. What is the probability that he could make 20 in a row before he misses? 

**by hand using the pmf**



**theoretical using R commands**



**using simulation**




## You try it: 
_Complete the following using both theoretical and simulation methods_

1. The 2010 American Community Survey estimates that 47.1% of women ages 15 years and over are married. We randomly select three women between these ages. 

a. What is the probability that the third women selected is the only one that is married? 

b. On average, how many women would you expect to sample before selecting a married woman? What is the standard deviation? 

2. A machine that produces a special type of transistor has a 2% defective rate. The production is considered a random process where each transistor is independent of the others. 

a. What is the probability that the 10th transistor produced is the first with a defect? 

b. What is the probability that the first failure occurs after the 4th transistor was produced? 

----

# Negative Binomial Distribution (Speegle 3.6.2)

## Example: Oil!
A geological study indicates that an exploratory oil well drilled in a particular region should strike oil with probability 0.2.  Write down the pmf, and then calculate the mean and variance. 

**Theoretical**



**Simulation**



Find the probability that the third oil strike comes on the fifth well drilled.


**by hand using the pmf**


**theoretical using R commands**



**using simulation**


## You try it: 
Ten percent of the engines manufactured on an assembly line are defective. 

* If engines are randomly selected one at a time and tested, what is the probability that the first non defective engine will be found on the second trial?



* What is the probability that the third non defective engine will be found on the fifth trial?


* Find the mean and variance of the number of trials on which the first non defective engine is found.


* Find the mean and variance of the number of failures until the third non defective engine is found. 

----

# Poisson Distribution (Speegle 3.6.1)

## Example
The Taurids meteor shower is visible on clear nights in the Fall and can have visible meteor rates around five per hour. What is the probability that a viewer will observe exactly eight meteors in two hours? 


**by hand using the pmf**


**theoretical using R commands**


**using simulation**


## You try it:
Suppose a typist makes typos at a rate of 3 typos per 10 pages. What is the probability that they will make at most one typo on a five page document?

----

# Hypergeometric Distribution (Speegle 3.6.3)

### Example
1. An urn contains nine chips, five red and four white.  Three are drawn out at random without replacement. Let $X$ denote the number of red chips in the sample. Identify the parameters, and find $E(X)$ and $Var(X)$.

**Theoretical**


**Simulation**



2. In a small pond there are 50 fish, 10 of which have been tagged.  If a fisherman's catch consists of 7 fish, selected at random and without replacement, and $X$ denotes the number of tagged fish, what is the probability that exactly 2 tagged fish are caught?
  
  
**by hand using the pmf**
  

**theoretical using R commands**
  


**using simulation**
  



### You try it:
1. Suppose that there are 3 defective items in a lot of 50 items.  A sample of size 10 is taken at random and without replacement.  Let $X$ denote the number of defective items in the sample.  Find the probability that the sample contains

a. Exactly 1 defective item. 

b. At most 1 defective item.



2. A display case contains thirty-five diamonds, of which ten are real diamonds and twenty-five are fake diamonds. A burglar removes four gems at random, one at a time and without replacement.  What is the probability that the last gem she steals is the second real diamond in the set of four?


