Get startedGet started for free

Replicating samples

When you calculate a point estimate such as a sample mean, the value you calculate depends on the rows that were included in the sample. That means that there is some randomness in the answer. In order to quantify the variation caused by this randomness, you can create many samples and calculate the sample mean (or another statistic) for each sample.

attrition_pop is available; pandas and matplotlib.pyplot are loaded with their usual aliases.

This exercise is part of the course

Sampling in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create an empty list
____
# Loop 500 times to create 500 sample means
____:
	mean_attritions.append(
    	attrition_pop.sample(n=60)['Attrition'].mean()
	)
  
# Print out the first few entries of the list
print(mean_attritions[0:5])
Edit and Run Code