parapsychology

reference:
- ISI, exploration 2.3, p.142

library(tidyverse)
library(knitr)

hypotheses

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

State \(\pi\) and \(\alpha\).

pi <- 0.25          # from the null hypothesis
alpha <- 0.05       # level of significance

observed \(\widehat{p}\)

x <- 709
n <- 2124
(p.hat.observed <- x / n)
## [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.2669492 0.2377589 0.2448211 0.2438795 0.2476460 0.2462335 0.2702448
##  [8] 0.2358757 0.2368173 0.2452919

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.242 0.247 0.234 0.258 0.246 ...
ggplot(df, aes(p.hat)) +
  geom_histogram(color = "saddlebrown", fill = "wheat") +
  labs(title = "Sampling Distribution of p.hat")