2 min read

A p-value picture

Much ado and to say about the p-value. Let me add one more point; actually not really from myself, but from Diez, Barr, and Cetinkaya-Rundel (2012), p. 189; good book in one is looking for “orthodox” statistics.

library(tidyverse)
## ── Attaching packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.0.0     ✔ purrr   0.2.5
## ✔ tibble  1.4.2     ✔ dplyr   0.7.6
## ✔ tidyr   0.8.1     ✔ stringr 1.3.1
## ✔ readr   1.1.1     ✔ forcats 0.3.0
## Warning: package 'dplyr' was built under R version 3.5.1
## ── Conflicts ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
ggplot(NULL, aes(c(-5,5))) +
  geom_area(stat = "function", fun = dnorm, fill = "grey40", xlim = c(-5, 2)) +
  geom_area(stat = "function", fun = dnorm, fill = "#00998a", xlim = c(2, 5)) +
  labs(y = "",
       x = "X") +
  theme(axis.text = element_blank(),
        axis.ticks = element_blank())

This picture should now be annotated with something along the lines

  • “This is the distribution of \(\bar{x}\) if \(H_0\) is true” and
  • “The green shaded area corresponds to the chance of observing \(\bar{x}\) or a \(\bar{x}\) even more favorable towards \(H_A\)”.

Unfortunately, I have struggled to get annotations in this ggplot diagram with line breaks and with TeX fomulas (either one, no problem, both - did not work). That’s why I have prepared the annotation with an external paint program, which worked like a charm.

The annotations are in German as I am planning to make use of it in class.

Literature

Diez, David M, Christopher D Barr, and Mine Cetinkaya-Rundel. 2012. OpenIntro Statistics. CreateSpace.