Diễn giải khoảng tin cậy

Suy luận cho dữ liệu phân loại trong R

Andrew Bray

Assistant Professor of Statistics at Reed College

Khoảng tin cậy

Kết luận: tỷ lệ thực sự người Mỹ hạnh phúc nằm trong khoảng 0,705 đến 0,841.

Chúng ta “tin cậy” nghĩa là gì?

Suy luận cho dữ liệu phân loại trong R

Bộ dữ liệu 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

Suy luận cho dữ liệu phân loại trong R

one.png

Suy luận cho dữ liệu phân loại trong R

two.png

Suy luận cho dữ liệu phân loại trong R

three.png

Suy luận cho dữ liệu phân loại trong R

four.png

Suy luận cho dữ liệu phân loại trong R

five.png

Suy luận cho dữ liệu phân loại trong R

six.png

Suy luận cho dữ liệu phân loại trong R

seven.png

Suy luận cho dữ liệu phân loại trong R

eight.png

Suy luận cho dữ liệu phân loại trong R

nine.png

Suy luận cho dữ liệu phân loại trong R

ten.png

Suy luận cho dữ liệu phân loại trong R

Bộ dữ liệu 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

Suy luận cho dữ liệu phân loại trong R

Bộ dữ liệu 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

Suy luận cho dữ liệu phân loại trong R

Bộ dữ liệu 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

Suy luận cho dữ liệu phân loại trong R

Bộ dữ liệu 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

Suy luận cho dữ liệu phân loại trong R

Bộ dữ liệu 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

Suy luận cho dữ liệu phân loại trong R

Bộ dữ liệu 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

Suy luận cho dữ liệu phân loại trong R

Bộ dữ liệu 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

Suy luận cho dữ liệu phân loại trong R

Khoảng tin cậy

Diễn giải: “Chúng ta tin cậy 95% rằng tỷ lệ thực sự người Mỹ hạnh phúc nằm trong khoảng 0,705–0,841.”

Độ rộng khoảng bị ảnh hưởng bởi

  • n
  • mức độ tin cậy
  • p
Suy luận cho dữ liệu phân loại trong R

¡Vamos a practicar!

Suy luận cho dữ liệu phân loại trong R

Preparing Video For Download...