dolphins

reference:
- Tintle, et al., ISI, example 1.1, p. 23

hypotheses

The null hypothesis is that the dolphin’s choices are indistinguishable from those obtained by flipping a fair coin.

Define \(\pi\).

SOLUTION:

State the hypotheses.

\[H_0 : \pi = 0.5\] \[H_a : \pi \not= 0.5\]

State \(\pi\)

pi <- 0.5          # fair coin

observed statistic

x <- 15               # number of successes
n <- 16               # sample size
(p.hat.observed <- x / n)
## [1] 0.9375

data

dolphins <- data.frame(response = c("correct", "incorrect"),
                       p = c(p.hat.observed, 1 - p.hat.observed))
dolphins
##    response      p
## 1   correct 0.9375
## 2 incorrect 0.0625
str(dolphins)
## 'data.frame':    2 obs. of  2 variables:
##  $ response: Factor w/ 2 levels "correct","incorrect": 1 2
##  $ p       : num  0.9375 0.0625
ggplot(dolphins, aes(response, p, fill = response)) +
  geom_bar(stat = "identity") +
  scale_fill_manual(values = c("papayawhip", "rosybrown")) +
  labs(title = "Dolphins")