Probability vs. Statistics
Probability is used to predict the likelihood of a future event.
vs
Statistics are used to analyze past events
Basics of Probability
Probability, in simple terms, is the likelihood of a situation happening. When unsure of the outcome, the probability can be calculated to know its chances.
Probability(Event)=(Number of favourable outcomes of an event) / (Total Number of possible outcomes)
The most simple example of this is a coin toss:
A coin toss can have one of 2 outcomes, either heads or tails, and both have an equal chance of happening. So the probability of either situation happening is 0.5.
Mathematically: p(heads)= 0.5 and p(tails)=0.5
The probability of certain outcomes occurring can be uneven as well.
For example is the probability of getting a prime number between 1 and 10.
In 1 to 10, there are 2,3,5,7, i.e., 4 out of 10
Hence the probability becomes 4/10 = 0.4
In 1 to 10, there is one unique number 1, i.e., 1/10
Hence probability becomes 1/10 or 0.1
In 1 to 10, there are5 composite numbers, i.e., 4,6,8,9,10
Hence the probability becomes 5/10= 0.5
Properties of probability:
- The probability of an event can only be between 0 and 1 and can also be written as a percentage.
- The probability of event A is often written as P(A).
- If P(A) > P(B), then event A has a higher chance of occurring than event B.
- If P(A) = P(B), then events A and B are equally likely to occur.
- The Sum of probabilities of all possible situation outcomes is always 1.
- The probability of a sure situation is 1
- The probability of an impossible event is 0
Continuing with the above example, it is seen that
p(prime)= 0.4
p(unique)=0.1
p(composite)=0.5
- All probabilities are between 0 and 1
- p(composite)> p(prime) > p(unique)
Shows that selecting a composite has a higher chance of occurring than selecting a prime or unique number.
- p(composite)=p(non-composite)=0.5 hence both are equally likely to occur.
- Sum of probabilities
p(prime) + p(composite) + p(unique) = 0.4 + 0.1 + 0.5
= 1
If A and B are two independent events, then the probability that both will occur is equal to the product of their probabilities.
p(A ⋂ B)= p(A)* p(B)
Conditional Probability
Conditional probability is defined as the likelihood of an event or outcome occurring based on the occurrence of a previous event or outcome.
This is mathematically denoted by p(A/B), which means the probability of A given B has already occurred.
p(A/B) = p(A ⋂ B)/ p(B)
70% of your friends like Chocolate, and 35% like Chocolate AND like Strawberries.
What percent of those who like Chocolate also like strawberries?
P(Strawberry|Chocolate) = P(Chocolate and Strawberry) / P(Chocolate)
0.35 / 0.7 = 50%
Bayes theorem
Bayes’s Theorem provides a principled way of calculating conditional probability.
An example of a use-case for the Bayes theorem
The probability of a woman getting cancer in a region is 0.05 The machine used to test this has an 85% chance of being correct, and a woman without cancer has a 92.5% chance of getting a negative result. If a woman comes in to get tested and it comes out positive. What is the probability that she has cancer?
P(Cancer) = 0.005
P(Test Positive | Cancer) = 0.85
P(Test Neg|No cancer) = 0.925
Using the Bayes theorem:
P(Cancer|Test Positive)= P(Cancer) * P(Test Positive | Cancer) / P(Test Positive)
For this P(Test Positive) is still required
Let’s create a probability table for the same
Probability of having cancer or not | Test being positive | Test being negative | |
cancer | 0.05 | 0.05*0.85=0.00425 | 0.005*0.15=0.00074 |
No cancer | 0.995 | 0.995*0.075=0.074625 | 0.995*0.925=0.920375 |
Sum | 1 | 0.078875 | 0.921125 |
This is one of the cases when the Bayes theorem is used in real life.