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

Connected

Exercise

3 kinds of sampling

Let's compare the performance of point estimates using simple, stratified, and cluster sampling. Before we do that, you'll have to set up the samples.

In these exercises, we'll use the RelationshipSatisfaction column of the attrition dataset, which categorizes the employee's relationship with the company. It's an ordered factor with four levels: Low, Medium, High, and Very_High.

Instructions 1/3

undefined XP
  • 1

    Perform simple random sampling on attrition_pop to get one quarter of the population.

  • 2

    Perform stratified sampling on attrition_pop to get one quarter of the population of each RelationshipSatisfaction group. Remember to ungroup the result.

  • 3
    • Get unique values of attrition_pop's RelationshipSatisfaction column.
    • Randomly sample satisfaction_unique to get two values.
    • Perform cluster sampling on the selected satisfaction groups, sampling one quarter of the population and ungrouping the result.