oldoc63 / learningDS

Learning DS with Codecademy and Books
0 stars 0 forks source link

Variance of the Binomial Distribution #430

Open oldoc63 opened 1 year ago

oldoc63 commented 1 year ago

Variance for the Binomial distribution is similarly calculated using the n and p parameters. Let's use the 10 fair coin flips example to try to understand how variance is calculated. Each coin flip has a certain probability of landing as heads or tails: 0.5 and 0.5, respectively.

The variance of a single coin flip will be the probability that the success happens times the probability that it does not happen: p(1-p), or 0.5 x 0.5. Because we have n = 10 number of coin flips, the variance of a single fair coin flip is multiplied by the number of flips. Thus we get the equation:

$$ Variance(NumberOfHeads) = Var(X) = n.p.x(1-p) $$

$$ Variance(NumberOfHeads) = 10x0.5x(1-0.5) = 2.5 $$

Let's consider our 20 multiple choice quiz again. The variance around getting an individual question correct would be p(1-p), or 0.25 x 0.75. We then multiply this variance for all 20 questions in the quiz and get:

$$ Variance(NumberOfCorrectAnswers) = 20 x 0.25 x (1-0.25) = 3.75 $$

We would expect to get 5 correct answers, but the overall variance of the probability distribution is 3.75.