---
title: "Normal and Gamma Examples"
author: "Adapted from original lab by Prof Wagaman"
output: pdf_document
---

### Normal and Gamma Probabilities in R

Use R to compute the following probabilities:

Let $X \sim N(50,25)$. Here is what the distribution of X looks like:

```{r}
x<-seq(from = 30, to = 70, by = .1)
plot(x,dnorm(x,50,5),type="l")
```


1) Find the probability that X is greater than 53.6.

```{r}

```


2) Find the probability that X is between 46 and 54.

```{r}

```

3) Report the value of X that corresponds to the 87th percentile. 

```{r}

```

4) Let $Y \sim Gamma(5,2)$. Plot the distribution of Y. 

```{r}

```

5) Find the probability that Y is less than 1.5.

```{r}

```

6) Find the probability that Y is greater than 3 but less than 6.

```{r}

```

7) Find the 20th quantile for Y.

```{r}

```


### Practice Problems

1) The response times for an online computer terminal have approximately a gamma distribution with mean 4 seconds and variance 8 seconds$^2$. Identify the parameters of the appropriate gamma distribution. Calculate the probability that the response time is longer than 10 seconds. 

```{r}

```

2) The length of time $Y$ necessary to complete a key operation in the construction of houses has an exponential distribution with mean 10 hours. The formula $C=100 +40Y+3Y^2$ relates the cost C to the square of the time to completion. What is the expectation for C? 

```{r}

```

3) The pH of the red sludge from the Hungarian alumina plant is of interest because of the quantity of sludge released into the rivers nearby.  The pH has been decreasing from initial values near 13, but pH levels at 9 or above are still high, and indicate further efforts are needed to reduce pH (dumping plaster or absorbing chemicals). Suppose the probability of obtaining a high pH (9 or above) is .65. An EU official has commissioned a pH study in which a total of 248 sludge samples are taken (you can assume this is a random sample, and treat samples as independent) a week after the flood. What is the approximate probability that more than 172 samples have high pH?  

Hint: How would you model X = the number of samples with high pH? What distribution could approximate this model?

```{r}

```


4) Average human body temperature is often reported as 98.6 degrees Fahrenheit. It's actually closer to 98.2 as an average. Assuming the standard deviation is .7 degrees, and that human body temperature can be modelled using a normal distribution (it's actually not a bad fitting model), address the following questions.  
a. The coolest 20 percent of people have body temperatures at or below what temperature?   
b. If a fever is 101 degrees or above, how likely is someone to have a fever temperature as their normal body temperature?   
c. What percentage of people have body temperatures below 98 degrees F?   


```{r}

```
