parapsychology

reference:
- ISI, exploration 2.3 and example 3.5b, p.142 and p.200

library(tidyverse)
library(knitr)

hypotheses

\[H_0 : \pi = 0.25\] \[H_a : \pi > 0.25\]

observed \(\widehat{p}\)

x <- 709
n <- 2124
p.hat.observed <- x / n
p.hat.observed
## [1] 0.3338041

simulation

Design an experiment: “success” means the receiver correctly guessed the message … choose “success” with probabiity 0.25 … repeat 2124 times … report the proportion of successes

parapsychology2124 <- function(){
  samp <- sample(0:1, size = n, prob = c(0.75, 0.25), replace = TRUE)
  p.hat <- mean(samp)
  return(p.hat)
}

Repeat the experiment 10 times.

replicate(10, parapsychology2124())
##  [1] 0.2448211 0.2500000 0.2495292 0.2598870 0.2500000 0.2481168 0.2523540
##  [8] 0.2565913 0.2504708 0.2490584

simulated sampling distribution of \(\widehat{p}\)

Repeat the experiment 1,000 times and display the results.

n.experiments <- 1000
df <- data.frame(p.hat = replicate(n.experiments, parapsychology2124()))
str(df)
## 'data.frame':    1000 obs. of  1 variable:
##  $ p.hat: num  0.248 0.239 0.235 0.234 0.256 ...
ggplot(df, aes(p.hat)) +
  geom_histogram(color = "saddlebrown", fill = "wheat") +
  labs(title = "Sampling Distribution of p.hat")