---
title: "Homework 10"
author: "Insert Name"
date: "Math 141, Week 10"
output:
  pdf_document
graphics: yes
urlcolor: blue
---

```{r setup, include=FALSE}
# Do not modify this chunk.
knitr::opts_chunk$set(echo = T, message=FALSE, warning = FALSE, fig.align = "center")
library(knitr)
library(tidyverse)
library(moderndive)
library(infer)
```


**Due: 11:59pm, Friday April 8**

# Instructions
Work through the problems below  and submit this document as a knitted .pdf to the Math 141 S22 Wells Lecture [gradescope page](https://www.gradescope.com/courses/354598). 

**For each problem, put your solution between the bars of red stars.**



### Acknowledgements
If you work with a classmate, please write a note acknowledging this.



### Exercise 1

Suppose A and B are events with P(A) = 0.3 and P(B) = 0.7.

a.  Is it always possible to compute P(A and B) if you only know P(A) and P(B)?

********************************************************


********************************************************

b.  Assuming that events A and B arise from independent random processes, find P(A and B) and P(A | B).

********************************************************


********************************************************
  
c.  Suppose we are given that P(A and B) = 0.1. Are events A and B independent? Explain.

********************************************************


********************************************************

d.  If we are given that P(A and B) = 0.1 , what is P(A | B)?

********************************************************


********************************************************

### Exercise 2

Lupus is a medical phenomenon where antibodies that are supposed to attack foreign cells to prevent infections instead see plasma proteins as foreign bodies, leading to a high risk of blood clotting. It is believed that 2% of the population suffer from this disease. The test is 98% accurate if a person actually has the disease. The test is 74% accurate if a person does not have the disease. There is a line from the Fox television show *House* that is often used after a patient tests positive for lupus: "It's never lupus." Do you think there is truth to this statement? Use appropriate probabilities to support your answer.


********************************************************


********************************************************


### Exercise 3

Earlier in the term, students in Math 141 were asked two questions as part of a larger survey: "Are hot dogs sandwiches?" and "If dogs wore pants, would they wear them on their front legs, back legs, or on all four legs"? A summary of responses for 70 students is given below:

|             | Hotdog is a sandwich | Hotdog is not a sandwich |
|-------------|----------------------|---------------------------|
| Front legs  |         1            |             1             |
| Back legs   |        17            |            26             |
| All 4 legs  |         9            |            16             |

Suppose we randomly choose 1 student who completed this survey.

a. Are the events "the student thinks a hotdog is not a sandwich" and "the student thinks dogs should wear pants on their back legs" mutually exclusive?

********************************************************


********************************************************

b. What is the probability that the randomly chosen student thinks a hotdog is a sandwich?

********************************************************


********************************************************

c. What is the probability that the randomly chosen student thinks a hotdog is a sandwich and thinks that dogs should wear pants on all 4 legs?

********************************************************


********************************************************

d. What is the probability that the randomly chosen student thinks a hotdog is a sandwich given that the student thinks dogs should wear pants on all 4 legs?

********************************************************


********************************************************

e. Is the event "the student things a hotdog is a sandwich" independent of the event "the student thinks dogs should wear pants on their front legs"?

********************************************************


********************************************************

### Exercise 4

Suppose the number of hours a particular student takes to complete a statistics exam is modeled by a continuous random variable $T$ with the following density function:

```{r fig.width=6, echo = F}
t <- seq(1,3, by =.1)
p <- ifelse(t<=2, t-1, 3-t)
density_df <- data.frame(t,p)
ggplot(density_df, aes(x = t, y = p))+
  geom_line()+
  labs(x = "T", y = "density", title = "Density Function for Hours Spent on Exam")+
  coord_fixed()+
  scale_x_continuous(breaks = seq(1,3,by=.25))
```

Models of this type arise frequently in settings where we have sparse information to model a continuous phenomenon (i.e. we may only have estimates for the minimum, maximum, and most likely values for the phenomenon).

For each of the following parts of the problem, use *geometric reasoning* to compute areas (you do not need to use calculus to answer any of these problems). Recall that the area of a triangle is $A = 0.5*base*height$.

a. Verify that the function plotted above indeed has area of 1.

********************************************************


********************************************************

b. What is the probability that the student takes at most 2.5 hours to complete the exam?

********************************************************


********************************************************

c. What is the value of $t$ so that a student has probability $0.08$ of completing the exam before time $t$.

********************************************************


********************************************************

d. During what interval of length $1$ does the student have the largest probability of completing the exam. That is, find a number $a$ so that $P(a < T < a+1)$ is as large as possible.

********************************************************


********************************************************