Een betrouwbaarheidsinterval interpreteren

Inferentie voor categorische gegevens in R

Andrew Bray

Assistant Professor of Statistics at Reed College

Betrouwbaarheidsintervallen

Conclusie: het echte aandeel Amerikanen dat gelukkig is, ligt tussen 0,705 en 0,841.

Wat bedoelen we met confident?

Inferentie voor categorische gegevens in R

Dataset 1

ds1 <- filter(gss, year == 2016)

p_hat <- ds1 %>% summarize(mean(happy == "HAPPY")) %>% pull()
SE <- ds1 %>% specify(response = happy, success = "HAPPY") %>% generate(reps = 500, type = "bootstrap") %>% calculate(stat = "prop") %>% summarize(sd(stat)) %>% pull()
c(p_hat - 2 * SE, p_hat + 2 * SE)
0.7073114 0.8393553

confidence-interval

Inferentie voor categorische gegevens in R

one.png

Inferentie voor categorische gegevens in R

two.png

Inferentie voor categorische gegevens in R

three.png

Inferentie voor categorische gegevens in R

four.png

Inferentie voor categorische gegevens in R

five.png

Inferentie voor categorische gegevens in R

six.png

Inferentie voor categorische gegevens in R

seven.png

Inferentie voor categorische gegevens in R

eight.png

Inferentie voor categorische gegevens in R

nine.png

Inferentie voor categorische gegevens in R

ten.png

Inferentie voor categorische gegevens in R

Dataset 2

ds2 <- filter(gss, year == 2014)

p_hat <- ds1 %>% summarize(mean(happy == "HAPPY")) %>% pull()
SE <- ds1 %>% specify(response = happy, success = "HAPPY") %>% generate(reps = 500, type = "bootstrap") %>% calculate(stat = "prop") %>% summarize(sd(stat)) %>% pull()
c(p_hat - 2 * SE, p_hat + 2 * SE)
0.8348831 0.9384503

Screenshot 2019-02-21 18.05.03.png

Inferentie voor categorische gegevens in R

Dataset 3

ds3 <- filter(gss, year == 2012)

p_hat <- ds1 %>% summarize(mean(happy == "HAPPY")) %>% pull()
SE <- ds1 %>% specify(response = happy, success = "HAPPY") %>% generate(reps = 500, type = "bootstrap") %>% calculate(stat = "prop") %>% summarize(sd(stat)) %>% pull()
c(p_hat - 2 * SE, p_hat + 2 * SE)
0.7626359 0.8906974

1-2-1.png

Inferentie voor categorische gegevens in R

Dataset 3

ds3 <- filter(gss, year == 2012)
p_hat <- ds3 %>%
  summarize(mean(happy == "HAPPY")) %>%
  pull()
SE <- ds3 %>%
  specify(response = happy, 
          success = "HAPPY") %>%
  generate(reps = 500, 
           type = "bootstrap") %>%
  calculate(stat = "prop") %>%
  summarize(sd(stat)) %>%
  pull()

c(p_hat - 2 * SE, p_hat + 2 * SE)
0.7626359 0.8906974

1-2-2.png

Inferentie voor categorische gegevens in R

Dataset 3

ds3 <- filter(gss, year == 2012)
p_hat <- ds3 %>%
  summarize(mean(happy == "HAPPY")) %>%
  pull()
SE <- ds3 %>%
  specify(response = happy, 
          success = "HAPPY") %>%
  generate(reps = 500, 
           type = "bootstrap") %>%
  calculate(stat = "prop") %>%
  summarize(sd(stat)) %>%
  pull()

c(p_hat - 2 * SE, p_hat + 2 * SE)
0.7626359 0.8906974

1-2-3.png

Inferentie voor categorische gegevens in R

Dataset 3

ds3 <- filter(gss, year == 2012)
p_hat <- ds3 %>%
  summarize(mean(happy == "HAPPY")) %>%
  pull()
SE <- ds3 %>%
  specify(response = happy, 
          success = "HAPPY") %>%
  generate(reps = 500, 
           type = "bootstrap") %>%
  calculate(stat = "prop") %>%
  summarize(sd(stat)) %>%
  pull()

c(p_hat - 2 * SE, p_hat + 2 * SE)
0.7626359 0.8906974

1-2-4.png

Inferentie voor categorische gegevens in R

Dataset 3

ds3 <- filter(gss, year == 2012)
p_hat <- ds3 %>%
  summarize(mean(happy == "HAPPY")) %>%
  pull()
SE <- ds3 %>%
  specify(response = happy, 
          success = "HAPPY") %>%
  generate(reps = 500, 
           type = "bootstrap") %>%
  calculate(stat = "prop") %>%
  summarize(sd(stat)) %>%
  pull()

c(p_hat - 2 * SE, p_hat + 2 * SE)
0.7626359 0.8906974

1-2-5.png

Inferentie voor categorische gegevens in R

Dataset 3

ds3 <- filter(gss, year == 2012)
p_hat <- ds3 %>%
  summarize(mean(happy == "HAPPY")) %>%
  pull()
SE <- ds3 %>%
  specify(response = happy, 
          success = "HAPPY") %>%
  generate(reps = 500, 
           type = "bootstrap") %>%
  calculate(stat = "prop") %>%
  summarize(sd(stat)) %>%
  pull()

c(p_hat - 2 * SE, p_hat + 2 * SE)
0.7626359 0.8906974

1-2-6.png

Inferentie voor categorische gegevens in R

Betrouwbaarheidsintervallen

Interpretatie: “We zijn 95% zeker dat het echte aandeel Amerikanen dat gelukkig is tussen 0,705 en 0,841 ligt.”

Breedte van het interval hangt af van

  • n
  • betrouwbaarheidsniveau
  • p
Inferentie voor categorische gegevens in R

Laten we oefenen!

Inferentie voor categorische gegevens in R

Preparing Video For Download...