---
title: 'Stat 140 -- Hypothesis Tests for Proportions Religiousness Around the World'
author: "Evan Ray (modified from Open Intro Lab 6)"
date: "November 8, 2017"
output:
  html_document: default
---


## 1. Religions Example

In the previous lab about confidence intervals for proportions, we looked at some data about religous views around the world.  Let's look at that data set again and conduct a hypothesis test.

```{r include=FALSE}
library(dplyr)
library(readr)
library(mosaic)
```

Let's load in the data and subset to obtain data for just the United States.

```{r head-data}
atheism <- read_csv("https://mhc-stat140-2017.github.io/data/openintro/atheism/atheism.csv")
head(atheism)
```

```{r}
us_2012 <- filter(atheism, nationality == "United States", year == "2012")
table(us_2012$response)
nrow(us_2012)
head(us_2012)
```

According to Wikipedia, in 1991 2\% of U.S. citizens identified as atheists (`https://en.wikipedia.org/wiki/Demographics_of_atheism#United_States`).  You suspect that this proportion has increased in the intervening years.  Conduct a test to evaluate this hypothesis.

#### Write down the null and alternative hypotheses

SOLUTION:


#### Check assumptions and conditions

SOLUTION:


#### Calculate a p-value.  Do this using the binom.test function and by hand using the pbinom function.  You should get the same answer both ways.

SOLUTION:

```{r}
# Your code goes here

```

#### Write down your conclusions

SOLUTION:



## 2. Empty Houses (Adapted from SDM 4.6)

According to the 2010 Cenus, 11.4% of all housing units in the United States were vacant.  A county supervisor wonders if her county is different from this.  She randomly selects 850 housing units in her county and finds that 129 of the housing units are vacant.

Conduct a test to evaluate the county supervisor's hypothesis.

#### Write down the null and alternative hypotheses

SOLUTION:


#### Check assumptions and conditions

SOLUTION:


#### Calculate a p-value.  Use the binom.test function (you don't need to do it again with the pbinom function).

SOLUTION:

```{r}
# Your code goes here

```

#### Write down your conclusions

SOLUTION:



