Bayes formulae for binary variables

#1
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
 
Last edited:
#3
Looks fine to me but I'm wondering what your data looks like or what information you have available.
Thank you very much for your response.

The underlying data have to do with a lab experiment in which lab rats press one of two levers and get one of two rewards. We want first figure out how close the rats are to the Bayesian ideal. We haven't finished the number-crunching yet (obviously), but we kinda know already that the animals are all over the place, and not even close to the ideal performance. We just need to figure out why, and that's going to take a whole lot of time-consuming work.

Hope this answers your question.