Błąd względny estymatorów punktowych

Próbkowanie w R

Richie Cotton

Data Evangelist at DataCamp

Próba jako liczba wierszy

coffee_ratings %>% 
  slice_sample(n = 300) %>% 
  nrow()
300
coffee_ratings %>% 
  slice_sample(prop = 0.25) %>% 
  nrow()
334
Próbkowanie w R

Różne rozmiary próby

coffee_ratings %>% 
  summarize(mean_points = mean(total_cup_points)) %>% 
  pull(mean_points)

82.15
coffee_ratings %>% 
  slice_sample(n = 10) %>% 
  summarize(mean_points = mean(total_cup_points)) %>% 
  pull(mean_points)
82.82
coffee_ratings %>% 
  slice_sample(n = 100) %>% 
  summarize(mean_points = mean(total_cup_points)) %>% 
  pull(mean_points)
82.02
coffee_ratings %>% 
  slice_sample(n = 1000) %>% 
  summarize(mean_points = mean(total_cup_points)) %>% 
  pull(mean_points)
82.16
Próbkowanie w R

Błędy względne

Parametr populacji

population_mean <- coffee_ratings %>% 
  summarize(mean_points = mean(total_cup_points)) %>% 
  pull(mean_points)

Estymator punktowy

sample_mean <- coffee_ratings %>% 
  slice_sample(n = sample_size) %>% 
  summarize(mean_points = mean(total_cup_points)) %>% 
  pull(mean_points)

Błąd względny w procentach

100 * abs(population_mean - sample_mean) / population_mean
Próbkowanie w R

Błąd względny a rozmiar próby

ggplot(errors, aes(sample_size, relative_error)) +
  geom_line() +
  geom_smooth(method = "loess")

Wykres punktowy błędu względnego w zależności od rozmiaru próby.

Próbkowanie w R

Czas na ćwiczenia!

Próbkowanie w R

Preparing Video For Download...