Session Ready
Exercise

Creating a probability distribution

A new restaurant opened a few months ago, and the restaurant's management wants to optimize its seating space based on the size of the groups that come most often. On one night, there are 10 groups of people waiting to be seated at the restaurant, but instead of being called in the order they arrived, they will be called randomly. In this exercise, you'll investigate the probability of groups of different sizes getting picked first. Data on each of the ten groups is contained in the restaurant_groups data frame.

Remember that expected value can be calculated by multiplying each possible outcome with its corresponding probability and taking the sum. The restaurant_groups data is available and dplyr and ggplot2 are loaded.

Instructions 1/4
undefined XP
  • 1
    • Create a histogram of the group_size column of restaurant_groups, setting the number of bins to 5.
    • 2
      • Count the number of each group_size in restaurant_groups, then add a column called probability that contains the probability of randomly selecting a group of each size. Store this in a new data frame called size_distribution.
    • 3
      • Calculate the expected value of the size_distribution, which represents the expected group size.
    • 4
      • Calculate the probability of randomly picking a group of 4 or more people by filtering and summarizing.