Exercise

Checking the result

Now try generating some samples and calculating the expected value and variance yourself, then using the method provided by binom to check if the sample values match the theoretical values.

The binom object and describe() method from scipy.stats are already loaded, so you can make the calculations.

Instructions

100 XP
  • Calculate the sample mean and variance of the sample variable.
  • Calculate the expected value using n=10 and p=0.3, and calculate the variance using mean, and 1 - p.
  • Use a binom method to get the expected value and variance for 10 coin flips with p=0.3.