1. Learn
  2. /
  3. Courses
  4. /
  5. Sampling in Python

Connected

Exercise

Comparing point estimates

Now that you have three types of sample (simple, stratified, and cluster), you can compare point estimates from each sample to the population parameter. That is, you can calculate the same summary statistic on each sample and see how it compares to the summary statistic for the population.

Here, we'll look at how satisfaction with the company affects whether or not the employee leaves the company. That is, you'll calculate the proportion of employees who left the company (they have an Attrition value of 1) for each value of RelationshipSatisfaction.

attrition_pop, attrition_srs, attrition_strat, and attrition_clust are available; pandas is loaded with its usual alias.

Instructions 1/4

undefined XP
  • 1

    Group attrition_pop by RelationshipSatisfaction levels and calculate the mean of Attrition for each level.

  • 2

    Calculate the proportion of employee attrition for each relationship satisfaction group, this time on the simple random sample, attrition_srs.

  • 3

    Calculate the proportion of employee attrition for each relationship satisfaction group, this time on the stratified sample, attrition_strat.

  • 4

    Calculate the proportion of employee attrition for each relationship satisfaction group, this time on the cluster sample, attrition_clust.