Exercise

Summary statistics: The mean

One of the first things that you would like to know about a probability distribution are some summary statistics that capture the essence of the distribution. One example of such a summary statistics is the mean. The mean of a probability distribution is calculated by taking the weighted average of all possible values that a random variable can take. In the case of a discrete variable, you calculate the sum of each possible value times its probability. Let's go back to our probability mass function of the first exercise.

Instructions

100 XP
  • Calculate the expected value of the probability distribution and store this in the variable expected_score. expected_score should be a number rounded to 1 decimal. Note that you have a dataframe data available in your console that contains a vector of outcomes called outcome and a vector of probabilities called probs. This dataframe is the exact same as the table displayed above.
  • Print the variable expected_score