0

I am not sure if that's a place to ask here (my type question)?

I am working to code in python but I am struggling to interpreter that to Python.

My question is : I have Pr(A | B) in the case of dependent which is equal to

Pr ( A ∩ B ) / Pr(B). I know how to do it by program, but I mean can I do that by python. On my idea I just multiply Pr ( A ) * Pr (B) then I / Pr(B). Which I think is not correct is there anyway to write that the conditional probability in python program, or what did is correct?

2
  • 2
    Your proposed implementation of conditional probability assumes independence, and is in fact just Pr(A). This follows from both your formula and intuition. Commented Jun 8, 2015 at 9:04
  • yes, P (A ∩ B) is not equal to P(A) * P(B) if event A and B are dependent Commented Jun 8, 2015 at 9:08

1 Answer 1

2

if you know values of P(A ∩ B) and P(B) , you can compute P(A | B) using

pB = 0.3
pAB=0.4

pAifB = pAB / pB
print(pAifB)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.