---
title: "R Problem due Tuesday 10/30"
author: "YOUR NAME"
output: pdf_document
---

```{r,include=FALSE}
require(mosaic)
```

Acknowledgements: ADD NAMES HERE IF ANYONE ASSISTED YOU.  

**Email knitted pdf file to tleise@amherst.edu by 4pm on the due date.**

As part of an internship at a company, you are tasked with analyzing their service call lengths. Suppose all calls are initially booked for one hour of service. Another intern feels that there are actually two types of service calls - one where an hour is sufficient to solve the problem, and another where more time is needed. In particular, the intern feels one group of service calls has a length that is normally distributed with mean 50 minutes and standard deviation of 4 minutes, while the second group of service calls has a mean of 80 minutes with a standard deviation of 6 minutes. It is estimated that 20 percent of the calls are in the longer length group, but that whether a call is short or long is random (you cannot tell in advance of starting the job). The current company policy books eight calls per day per service worker, with an expectation that those calls will be completed in the 8 hour workday. (There is no travel time and we assume no delay between calls.) 

Your supervisor wants you to generate data consistent with your fellow interns' thinking to examine the distribution of completion time for a daily set of eight calls. They want to know the expected value and standard deviation of the completion times, as well as understand the shape of the distribution. You are also to write a brief recommendation about the number of calls scheduled per day per worker. In particular, the company does not want workers performing more than 30 minutes of overtime on a regular basis. Some steps are outlined below to help you with this process.

a. What do you need to do in order to generate ONE day's worth of call times for ONE worker? 

> ANSWER

b. What will you need to do with one day's set of call times in order to find the expected value and standard deviation for the daily time spent on the 8 calls? (Hint: is ONE day worth of call times enough?)

> ANSWER

c. Write appropriate reproducible R code to generate data and determine what the expected completion time for a daily set of 8 calls is. 

```{r}


```

> ANSWER Based on my simulation, the expected completion time for a daily set of 8 calls is ??.?? minutes.

d. You should be able to use the same code (or a variant of it) to find the standard deviation and examine the distribution of completion times. Describe the shape of the distribution (one peak, two peaks, etc., symmetric or not) and report the mean and standard deviation. You should generate a histogram (e.g., use *hist*).

> ANSWER


e. Write a short recommendation about the number of calls scheduled per day per worker. Recall that the company does not want workers performing more than 30 minutes of overtime on a regular basis. Be sure to provide appropriate support for your recommendation. 

Be sure to include the proportion of daily work times that go beyond 8 hours and beyond 8.5 hours. For instance, you can use commands like length(simtimes[simtimes>480])/Nsims to calculate the proportion of simulated times that are over a threshold.

> ANSWER



*Acknowledgement: Thank you to Prof Amy Wagaman for sharing this R problem for STAT 360.*
