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.

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

atheism <- read_csv("https://mhc-stat140-2017.github.io/data/openintro/atheism/atheism.csv")
## Parsed with column specification:
## cols(
##   nationality = col_character(),
##   response = col_character(),
##   year = col_integer()
## )
head(atheism)
## # A tibble: 6 x 3
##   nationality    response  year
##         <chr>       <chr> <int>
## 1 Afghanistan non-atheist  2012
## 2 Afghanistan non-atheist  2012
## 3 Afghanistan non-atheist  2012
## 4 Afghanistan non-atheist  2012
## 5 Afghanistan non-atheist  2012
## 6 Afghanistan non-atheist  2012
us_2012 <- filter(atheism, nationality == "United States", year == "2012")
table(us_2012$response)
## 
##     atheist non-atheist 
##          50         952
nrow(us_2012)
## [1] 1002
head(us_2012)
## # A tibble: 6 x 3
##     nationality    response  year
##           <chr>       <chr> <int>
## 1 United States non-atheist  2012
## 2 United States non-atheist  2012
## 3 United States non-atheist  2012
## 4 United States non-atheist  2012
## 5 United States non-atheist  2012
## 6 United States non-atheist  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:

# 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:

# Your code goes here

Write down your conclusions

SOLUTION: