CommencezCommencez gratuitement

Distribution d'échantillonnage vs distribution bootstrap

La distribution d'échantillonnage et la distribution bootstrap sont étroitement liées. Dans les rares situations où vous pouvez échantillonner à répétition une population, et pendant que vous apprenez ces deux approches, il est utile de générer la distribution d'échantillonnage puis la distribution bootstrap, l'une après l'autre, pour voir comment elles se comparent.

Ici, la statistique qui vous intéresse est la moyenne du score popularity des chansons.

spotify_population (l'ensemble du jeu de données) et spotify_sample (500 lignes représentant un échantillon initial) sont disponibles; dplyr est chargé.

Cette activité fait partie du cours

Échantillonnage en R

Voir le cours

Exercice interactif pratique

Essayez cet exercice en complétant ce code d’exemple.

# Generate a sampling distribution
mean_popularity_2000_samp <- ___(
  # Use 2000 replicates
  ___,
  expr = {
    # Start with the population
    ___ %>% 
      # Sample 500 rows without replacement
      ___ %>% 
      # Calculate the mean popularity as mean_popularity
      ___ %>% 
      # Pull out the mean popularity
      ___
  }
)

# See the result
mean_popularity_2000_samp
Modifier et exécuter le code