The data

In a random sample of 75 Reed students, 66% support same sex marriage. A recent survey of the country as a whole finds that 50% of Americans support same sex marriage. Is the Reedie support for same sex marriage significantly different than the nation as a whole?

The procedure

  1. Let a coin flip represent selecting a random American. Heads = in favor.
  2. Flip a coin 75 times and compute the proportion of heads.
  3. Repeat step 2 many many times, logging the sample proportions
library(mosaic)
p_hats <- do(10000) * rflip(n = 75)
head(p_hats)
##    n heads tails prop
## 1 75    36    39 0.48
## 2 75    41    34 0.55
## 3 75    42    33 0.56
## 4 75    41    34 0.55
## 5 75    43    32 0.57
## 6 75    37    38 0.49
set.seed(24)
poll <- data.frame(person_id = 1:75,
                   favor = sample(rep(c("Yes", "No"), times = c(50, 25))))

The Hypotheses

Let \(p\) be the true proportion of Americans who favor same-sex marriage.

\[H_0: p = 0.5\]

\[H_A: p \ne 0.5\]

The Data

The observed test statistic was

\[\hat{p} = 0.66\]

The Null Distribution

p_hats %>% 
    ggplot(aes(x=prop)) +
    geom_histogram(binwidth=0.0134,fill="white",color="darkgreen") 

The Null Distribution

\[p.val \approx 0.006\]

The decision

\[ \alpha = .05; \quad p.val \approx .006 \]

Since

\[ p.val < \alpha\]

we find the data is inconsistent with our model, aka, we reject the null hypothesis.

Ways to find a Null Distribution

  1. Randomization/Simulation
  2. Probability Theory

Probability Theory

Let \(X\) be the total number of people in a sample of size 75 that favor same-sex marriage if the true population proportion that favor is 0.5.

\(x_{obs} = 75 \times 0.66 = 50\)

What is \(P(X > x_{obs})\)?

\[ X \sim Binom(n = 75, p = .5) \]

The Null Distribution

\[p.val = 0.002\]