---
title: "Stat 140 HW#6: SDM4 Chapters 15 -- 17"
author: "Your Name Goes Here"
date: "November 3, 2017"
output:
  html_document:
    fig_height: 3
    fig_width: 5
  pdf_document:
    fig_height: 2.8
    fig_width: 6
  word_document:
    fig_height: 3
    fig_width: 5
---


```{r include=FALSE}
# Don't delete this chunk if you are using the mosaic package
# This loads the mosaic and dplyr packages
require(mosaic); require(readr)
```

```{r include=FALSE}
# Some customization.  You can alter or delete as desired (if you know what you are doing).

# This changes the default colors in lattice plots.
trellis.par.set(theme=theme.mosaic())  

# knitr settings to control how R chunks work.
require(knitr)
opts_chunk$set(
  tidy=FALSE,     # display code as typed
  size="small"    # slightly smaller font for code
)
```

This homework is due at the start of class on Friday, November 3rd.

### PRACTICE PROBLEMS (not to be turned in; may be helpful for exam review):

SDM4 15.5, 15.7, 15.13, 15.15, 15.25, 15.27, 15.31, 15.41, 15.51

SDM4 16.1, 16.3, 16.17, 

Part IV review exercise 25, 31, 35, 43

SDM4 17.1, 17.3, 17.5, 17.9, 17.11, 17.13, 17.19, 17.29, 17.31, 17.41, 17.47, 17.49, 17.51

### PROBLEMS TO TURN IN:

#### SDM4 15.38 (Garden)

A company selling vegetable seeds in packages of 20 seeds estimates that the mean number of seeds that will actually grow is 18, with a standard deviation of 1.2 seeds.  You buy 5 different seed packets.

a) How many non-growing seeds to you expect to get in total, across all 5 seed packets?

SOLUTION:



b) What's the standard deviation of the number of non-growing seeds you will get in total across all 5 seed packets?  You may assume the seed packets are independent.

SOLUTION:



#### SDM4 16.18 (Lost luggage)

A Department of Transportation report about air travel found that airlines misplace about 5 bags per 1000 bags that are checked on flights.  Suppose that you are traveling with a group of people who have checked 22 bags on your flight.  Can you consider the fate of these bags to be Bernoulli trials?

SOLUTION:



#### SDM4 16.51, modified

Police estimate that 80% of drivers wear their seatbelts.  They set up a safety roadblock, stopping cars to check for seatbelt use.

a) Is a binomial distribution appropriate for modeling the total number of drivers who were wearing their seatbelts out of the first 30 drivers the police stop?

SOLUTION:



b) Regardless of your answer to part a), let's proceed by using a binomial distribution.  What's the probability that the first 30 drivers are all wearing their seatbelts?  Use the `dbinom` function in R.

SOLUTION:

```{r}
# Your code goes here

```

c) What's the probability that at least 20 of the first 30 drivers are wearing their seatbelts?  Use the `pbinom` function in R, but remember that pbinom calculates the probability that a binomial random variable is less than or equal to a given value, not greater than or equal to a given value.

SOLUTION:

```{r}

```

d) As they are planning this roadblock, what is the expected (average) number of drivers they will stop who aren't wearing their seatbelts, out of the first 30 drivers they stop?  What is the standard deviation?

SOLUTION:



#### Blue M and M's

My favorite color of M and M is blue, and I'm concerned that they may be putting fewer blue M and M's into bags than they used to.  Mars Company last published the distribution of colors for M and M's in 2008, and at that time 16% of M and M's were blue.  Suppose I get a sample of 100 M and M's, and I'm willing to assume that their colors are independent.  In my sample, there are 12 blue M and M's.

a) Would a binomial model be appropriate for the number of blue M and M's in my sample?  Assuming the null hypothesis that the proportion of M and M's that are blue hasn't changed, what would you use for the Binomial model parameters, n and p?

SOLUTION:



b) Assuming that it was still the case that 16% of M and M's were blue, how unlikely would it be to get a sample with 12 or fewer blue M and M's in it?  In other words, calculate the probability that the total number of blue M and M's in my sample is less than or equal to 12.  Does getting only 12 blue M and M's out of 100 offer convincing evidence that the percentage of M and M's that are blue is lower than 16%?

SOLUTION:

```{r}
# Your code goes here

```


c) Suppose I go out and get a new sample of 1000 M and Ms, and 120 of them are blue.  Would this offer convincing evidence that less than 16% of M and M's are blue?

SOLUTION:

```{r}
# Your code goes here

```

#### SDM4 17.24 (Smoking 2014)

The Centers for Disease Control and Prevention estimated in 2014 that 18.1% of American adults smoked cigarettes.  Using the 68-95-99.7 rule, describe the sampling distribution model for the proportion of smokers among a randomly selected group of 60 adults.  Be sure to discuss your assumptions and conditions.

SOLUTION:



#### SDM4 17.50 (Rainfall)

Statistics from Cornell's Northeast Regional Climate Center indicate that Ithaca, New York, gets an average of 35.4 inches of rain each year, with a standard deviation of 4.2 inches.  Assume that a Normal model applies.


a) During what percentage of years does Ithaca get more than 40" of rain?  Use R's `pnorm` function, but remember that pnorm computes the probability that a normal random variable is less than a specified value!

SOLUTION:

```{r}
# Your code goes here

```

b) Less than how much rain falls in the driest 20% of all years?  (i.e., find the 20th percentile of rainfall.)

SOLUTION:

```{r}
# Your code goes here.

```


c) A Cornell University student is in Ithaca for 4 years.  Let $\bar{y}$ represent the average rainfall amount for those 4 years.  Describe the sampling distribution model of this sample mean, $\bar{y}$.

SOLUTION:



d) What is the probability that the average rainfall in those 4 years is less than 30" of rain?

SOLUTION:

```{r}
# Your code goes here

```

