Aan de slagGa gratis aan de slag

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), 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 randomly sampled rows from spotify_population) are available; pandas and numpy are loaded with their usual aliases.

Deze oefening maakt deel uit van de cursus

Sampling in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

mean_popularity_2000_samp = []

# Generate a sampling distribution of 2000 replicates
____:
    mean_popularity_2000_samp.append(
    	# Sample 500 rows and calculate the mean popularity 
    	____
    )

# Print the sampling distribution results
print(mean_popularity_2000_samp)
Code bewerken en uitvoeren