oldoc63 / learningDS

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

Expected value of the Binomial Distribution #429

Open oldoc63 opened 1 year ago

oldoc63 commented 1 year ago

Other types of distributions have expected values and variances based on the given parameters, just like the Poisson distribution. Recall that the Binomial distribution has parameters n, representing the number of events and p, representing the probability of "success" (or the specific outcome we are looking for occurring).

Consider the following scenario: we flip a fair coin 10 times and count the number of heads we observe. How many heads would you expect to see? You might naturally think 5, and you would be right! What we are doing is calculating the expected value without even realizing it. We take the 10 coin flips and multiply it by the chance of getting heads, or one half, getting the answer of 5 heads. And that exactly the equation for the expected value of the binomial distribution:

$$ Expected(Number of Heads) = E(X) = n x p $$

oldoc63 commented 1 year ago

Note that if we were counting the number of heads out of 5 fair coin flips, the expected value would be:

$$ 5 (0.5) = 2.5 $$

It is OK for the expected value to be a fraction or have decimal values, though it would be impossible to observe 2.5 heads.

oldoc63 commented 1 year ago

Let's say we forgot to study, and we are going to guess B on all 20 questions of a multiple choice quiz. I we assume that every letter option(A, B, C, and D) has the same probability of being the right answer for each question, how many questions would be expect to get correct? n would equal to 20, because there are 20 questions, and p would equal to 0.25, because there is a 1 in 4 chance that B will be the right answer. Using the equation we can calculate:

$$ Expected(Number of Right Answers) = E(X) = 20(0.25) = 5 $$