# Dan's Segment 32

## To Calculate

1. This is a hyper-geometric distribution with the value $\frac{\binom{20}{1} \binom{80}{8}}{\binom{100}{9} } = 0.305$

To do the p-value test set up a contingency table with 1 and 8 in the first row and 19 and 72 in the second row. Then compute the expected value as outlined in the segment to get expected values of 7.2, 1.8, 72.8, and 18.2 for each cell. Then calculate the chi-squared statistic the normal way $(actual-expected)^2/expected$ and sum over all cells to get a value of .49, which we then plug into a chi-square cdf with 1 degree of freedom. Taking the integral gives a p-value of roughly .5, so this could not be less significant and we don't rule out the null hypothesis.

2. Assuming the number of jelly beans is large enough that removing a bean does not change the probabilities, this is a multi-nomial distribution $P(observed) = \frac{6!}{2!\cdot 2!\cdot 2!} (0.2)^2 (0.3)^2 (0.5)^2 = 0.081$

3. This is a hypergeometric distribution which looks like $P(observed) = \frac{\binom{2}{2} \binom{3}{2} \binom{5}{2}}{\binom{10}{6} } = 0.143$

## Class Activity

This was completed with Trettels, Noah, and Tameem. Tameem has the python version of our solution up on his page and I think Sean should have the matlab version, though I don't see it on his page.