---
title: "R Project 03 More on Inference"
author: "Your Name Here"
date: "`r Sys.Date()`"
output: html_document
---

# Problem 1

*In a study at the University of Southern California, 300 children with brain cancer ("cases") and 300 children without cancer ("controls") were sampled. The investigators recorded whether each child lived in a neighborhood with underground vs. overhead electrical wiring, along with ethnicity and income information.*

| Characteristic          | Cases | Controls |
|:------------------------|------:|---------:|
| High income             |    27 |       39 |
| Home was owned          |   216 |      228 |
| Underground wiring      |    42 |       21 |
| Father living in home   |   144 |      117 |

## a) Perform a hypothesis test for each characteristic.

*Test whether the proportion of cases differs from the proportion of controls at alpha = 0.05.*

```{r}
N <- c(300, 300)

# High income — use prop.test()

```

**Your interpretation:**

```{r}
# Home was owned

```

**Your interpretation:**

```{r}
# Underground wiring

```

**Your interpretation:**

```{r}
# Father living in the home

```

**Your interpretation:**

## b) Adjust the p-values for multiple testing.

```{r}
# Collect the four p-values and apply the Bonferroni adjustment (multiply by 4)

```

**Your interpretation: Explain what the adjustment does and why it is needed.**

## c) Which characteristic(s) show evidence of a difference after adjustment?

**Your interpretation:**

---

# Problem 2

*Sixty consecutive eruptions of the geyser Old Faithful are recorded. Variables: duration of eruption (Eruption), dormant period before (Dormant.Before), dormant period after (Dormant.After), and height (Height). Times are in minutes, height in meters.*

```{r}
OF <- read.csv("https://www.dropbox.com/s/dy0ibm9t0mjv646/OldFaithful.csv?dl=1")
```

## a) Construct a multiple regression model for predicting Dormant.After.

```{r}
# Use lm() with all three predictors

```

**Your interpretation: Write out the regression equation and identify which predictors are significant.**

## b) Eliminate non-significant variables and construct a new model.

```{r}
# Remove the least significant predictor and refit

```

**Your interpretation:**

```{r}
# Continue refining if needed

```

**Your interpretation: Write out the final regression equation.**

## c) Use the final model to predict Dormant.After.

*Given: Eruption = 3.2 minutes, Dormant.Before = 75 minutes, Height = 42 meters. (Hint: Not all values may be needed.)*

```{r}
# Use coefficients() from your final model to compute the prediction

```

**Your interpretation:**
