Conditional Probability II
You may remember from the lectures that the conditional probability of A given B is related to the conditional probability of B given A.
To demonstrate this, in your script we have provided the probability that a plant is a tree given that it lives outdoors saved as x
, and the probability that a plant lives outdoors given that it is a tree y
. According to the formula \(P(A | B) * P(B) = P(B | A) * P(A)\), you can multiply x
by the probability of B, and y
by the probability of A to make x
and y
equivalent. Let's try this!
This exercise is part of the course
Basic Statistics
Exercise instructions
- Using the
plants
probability table saved in your console, identify the value of P(A) and P(B) and add these in the correct parts of your script. - Hit submit and look at the values of x and y.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Probability that a plant is a tree, given that it lives outdoors
x <- 0.275 *
# Probability that a plant lives outdoors, given that it is a tree
y <- 0.6875 *
# Print x and y
c(x, y)