Hi Everyone,

We have a research project where both the underlying variables A and B are binary variables (i.e., categorical variables with two levels each). We need to write scripts to calculate the Bayesian conditional probabilities for the various values of A and B. To do so, I have worked out the following equations 1 through 4. Any feedback as to whether they are correct would be greatly appreciated.

Eq 1: p(A=1 | B=1) = [p(A=1)p(B=1 | A=1)] / { [p(A=1)p(B=1 | A=1)] + [p(A=0)p(B=1 | A=0)]}

Eq. 2: p(A=1 | B=0) = [p(A=1)p(B=0 | A=1)] / { [p(A=1)p(B=0 | A=1)] + [p(A=0)p(B=0 | A=0)]}

Eq 3: p(A=0 | B=1) = [p(A=0)p(B=1 | A=0)] / { [p(A=0)p(B=1 | A=0)] + [p(A=1)p(B=1 | A=1)]}

Eq. 4: p(A=0 | B=0) = [p(A=0)p(B=0 | A=0)] / { [p(A=0)p(B=0 | A=0)] + [p(A=1)p(B=0 | A=1)]}

Thank you very much in advance,

Pamela

We have a research project where both the underlying variables A and B are binary variables (i.e., categorical variables with two levels each). We need to write scripts to calculate the Bayesian conditional probabilities for the various values of A and B. To do so, I have worked out the following equations 1 through 4. Any feedback as to whether they are correct would be greatly appreciated.

Eq 1: p(A=1 | B=1) = [p(A=1)p(B=1 | A=1)] / { [p(A=1)p(B=1 | A=1)] + [p(A=0)p(B=1 | A=0)]}

Eq. 2: p(A=1 | B=0) = [p(A=1)p(B=0 | A=1)] / { [p(A=1)p(B=0 | A=1)] + [p(A=0)p(B=0 | A=0)]}

Eq 3: p(A=0 | B=1) = [p(A=0)p(B=1 | A=0)] / { [p(A=0)p(B=1 | A=0)] + [p(A=1)p(B=1 | A=1)]}

Eq. 4: p(A=0 | B=0) = [p(A=0)p(B=0 | A=0)] / { [p(A=0)p(B=0 | A=0)] + [p(A=1)p(B=0 | A=1)]}

Thank you very much in advance,

Pamela

Last edited: