This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
bayesian_statistics [2019/10/03 02:36] floyd |
bayesian_statistics [2019/10/03 02:58] floyd |
||
---|---|---|---|
Line 1: | Line 1: | ||
Here is an example of Bayesian statistics from genetics. Probabilities and frequencies have been rounded and some genetic details of the system are simplified for convenience; | Here is an example of Bayesian statistics from genetics. Probabilities and frequencies have been rounded and some genetic details of the system are simplified for convenience; | ||
- | You are doing a project on quantifying the reproductive success of mice with the // | + | You are doing a project on quantifying the reproductive success of male mice with the // |
Let's say that we observe a single +/+ offspring. Now we need to calculate the probability of our data, $P(D)$. This is integrated over all models. Either the parent is a heterozygote, | Let's say that we observe a single +/+ offspring. Now we need to calculate the probability of our data, $P(D)$. This is integrated over all models. Either the parent is a heterozygote, | ||
Line 11: | Line 11: | ||
We are interested in the probability of the model given the data and it turns out that | We are interested in the probability of the model given the data and it turns out that | ||
$$P(M) \cap P(D)=P(M|D) P(D) = P(D|M) P(M)\mbox{.}$$ | $$P(M) \cap P(D)=P(M|D) P(D) = P(D|M) P(M)\mbox{.}$$ | ||
- | The joint probability (intersection, | + | The joint probability (intersection, |
Perhaps it is a bit more clearer by looking abstractly at the intersection of A and B given that B happened. | Perhaps it is a bit more clearer by looking abstractly at the intersection of A and B given that B happened. | ||
$$P(A|B)=\frac{P(A \cap B)}{P(B)} $$ | $$P(A|B)=\frac{P(A \cap B)}{P(B)} $$ | ||
+ | |||
+ | {{probabilityintersection.png? | ||
+ | |||
The overlap of A and B out of the total B is the probability of A given B. This can be rearranged to | The overlap of A and B out of the total B is the probability of A given B. This can be rearranged to | ||
- | $$P(A|B)P(B)=P(A \cap B)\mbox{.}$$ | + | $$P(A|B)P(B)=P(A \cap B)$$ |
- | (Note to draw a Venn diagram here to illustrate.) | + | and the same can be done for |
+ | $$P(B|A)P(A)=P(A \cap B)\mbox{.}$$ | ||
For example, you go to a pet store looking for a small mammal with white fur. There is a box and you are told that one out of six animals in the box have white fur and that there are both eight mice and ten hamsters in the box for a total of 18 individuals. 2 of the mice have white fur and 1 of the hamsters have white fur. Before you reach in the box you know the probability of grabbing an individual with white fur is $3/18 = 0.1\bar{6}$ You reach in and can feel that you have grabbed a mouse but can't see it yet. Given that you have a mouse the probability of white fur is now | For example, you go to a pet store looking for a small mammal with white fur. There is a box and you are told that one out of six animals in the box have white fur and that there are both eight mice and ten hamsters in the box for a total of 18 individuals. 2 of the mice have white fur and 1 of the hamsters have white fur. Before you reach in the box you know the probability of grabbing an individual with white fur is $3/18 = 0.1\bar{6}$ You reach in and can feel that you have grabbed a mouse but can't see it yet. Given that you have a mouse the probability of white fur is now | ||
$$P(\mbox{white}|\mbox{mouse})=\frac{\mbox{white}\cap\mbox{mouse}}{P(\mbox{mouse})}=\frac{2/ | $$P(\mbox{white}|\mbox{mouse})=\frac{\mbox{white}\cap\mbox{mouse}}{P(\mbox{mouse})}=\frac{2/ | ||
Line 28: | Line 33: | ||
Let's bring this into our example. | Let's bring this into our example. | ||
$$P(M_1|D) = \frac{P(D|M_1) P(M_1)}{P(D)}\mbox{.}$$ | $$P(M_1|D) = \frac{P(D|M_1) P(M_1)}{P(D)}\mbox{.}$$ | ||
- | We saw above that $P(D) = P(M_1) P(D|M_1) + P(M_2) P(D|M_2)\mbox{, | + | We saw above that $P(D) = P(M_1) P(D|M_1) + P(M_2) P(D|M_2)\mbox{, |
$$P(M_1|D) = \frac{P(D|M_1) P(M_1)}{ P(D|M_1) P(M_1) + P(D|M_2) P(M_2)}$$ | $$P(M_1|D) = \frac{P(D|M_1) P(M_1)}{ P(D|M_1) P(M_1) + P(D|M_2) P(M_2)}$$ | ||
The equation is really a fraction out of the total of all possibilities (of the data under all models). | The equation is really a fraction out of the total of all possibilities (of the data under all models). | ||
Line 34: | Line 39: | ||
$$P(M_1|D) = \frac{0.1 \times 0.05}{ 0.1 \times 0.05 + 1 \times 0.95} = \frac{0.005}{0.955} \approx 0.00524$$ | $$P(M_1|D) = \frac{0.1 \times 0.05}{ 0.1 \times 0.05 + 1 \times 0.95} = \frac{0.005}{0.955} \approx 0.00524$$ | ||
- | This $P(M_1|D) | + | This $P(M_1|D) |
What if we observed a second +/+ offspring? The probability of the data under the first hypothesis is now $P(D|M_1) = 0.1^2=0.01$ and $P(D|M_2) = 1^2=1$. | What if we observed a second +/+ offspring? The probability of the data under the first hypothesis is now $P(D|M_1) = 0.1^2=0.01$ and $P(D|M_2) = 1^2=1$. | ||
Line 47: | Line 52: | ||
Let's say that we didn't see a heterozygous offspring; how many observations are enough to be reasonably confident that the male parent was a +/+ homozygote? Bayes factor is a proposed way to address this. It is a ratio of the two probabilities of the data given the models (here $M_2$ is in the numerator because it has more support from the data). | Let's say that we didn't see a heterozygous offspring; how many observations are enough to be reasonably confident that the male parent was a +/+ homozygote? Bayes factor is a proposed way to address this. It is a ratio of the two probabilities of the data given the models (here $M_2$ is in the numerator because it has more support from the data). | ||
- | $$K = \frac{P(D|M_2)}{P(D|M_1} $$ | + | $$K = \frac{P(D|M_2)}{P(D|M_1)} $$ |
So with the observation of a single +/+ offspring $K_1 = \frac{1}{0.1} = 10$. | So with the observation of a single +/+ offspring $K_1 = \frac{1}{0.1} = 10$. | ||
Two +/+ offspring gives $K_2 = \frac{1}{0.01} = 100$. | Two +/+ offspring gives $K_2 = \frac{1}{0.01} = 100$. |