Codecademy Forums

NumPy Binomial Distribution Interpretation

https://www.codecademy.com/paths/data-science/tracks/intro-statistics-numpy/modules/dspath-intro-statistics/projects/election-binomial

The givens are:

  • There is a poll of sample size 70
  • We know that the true “success” rate in the population is 54% (i.e., in the general population, 54% voted for x)
  • The town has a population of 10,000

We would like to know how often our poll will accurately reflect the population

The suggested method is:
possible_surveys = np.random.binomial(survey_length, .54, 10000)/survey_length

… Where that formula, according to the instructions,

… takes the number of total survey responses, the actual success rate, and the size of the town’s population as its parameters.

:arrow_right: But, the 10000 in the formula is not the “size of the town’s population”, it is the number of experiments, not at all the same thing.

The size of the town’s population nowhere fits into the formula for a random binomial distribution. That third parameter basically just gives the length of the resulting array.