Sampling distribution vs. bootstrap distribution
The sampling distribution and bootstrap distribution are closely linked. In situations where you can repeatedly sample from a population (these occasions are rare) and as you learn about both, it's helpful to generate both the sampling distribution and the bootstrap distribution, one after the other, to see how they are related.
Here, the statistic you are interested in is the mean popularity
score of the songs.
spotify_population
(the whole dataset) and spotify_sample
(500 rows only representing an original sample) are available; dplyr
is loaded.
This exercise is part of the course
Sampling in R
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# 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