Probability In statistics
Basic idea
Experiment: a process the results in an outcome that cannot be predicted in advance with certainty.
Toss a Coin
S = {H,T}
Sample space: set of all possible outcomes
Rolling a die
S = {1,2,3,4,5,6}
Event: subset of the sample space
Back to the examples:
Let even A
be the roll of 1, A
={1}
Let event E
be an even role, E
={2,4,6}
Up to this point, you have been a “frequentist”
Plugging in the numbers:
Basic Axioms:
Axioms are the basic building blocks of probability theory.
Here are the three basic axioms:
P(a) is greater than or equal to 0, but less than or equal to 1 for all events a
P(S) is equal to 1
P(A or B) = P(A) + P(B) - P(A and B)
Ven Diagrams
Setting up the environment:
import micropip
await micropip.install("matplotlib")
await micropip.install("matplotlib_venn")
import matplotlib.pyplot as plt
from matplotlib_venn import venn2
# Data
labels = ['A', 'B', 'A and B']
plt.figure(figsize=(6, 4))
- Not in A
venn2(subsets=(1, 0, 0), set_labels=labels)
plt.title('Not in A')
plt.show()
- Not in B
venn2(subsets=(0, 1, 0), set_labels=labels)
plt.title('Not in B')
plt.show()
- A and B
venn2(subsets=(0, 0, 1), set_labels=labels)
plt.title('A and B')
plt.show()
- A or B
venn2(subsets=(1, 1, 1), set_labels=labels)
plt.title('A or B')
plt.show()
- DeMorgans Law
DeMorgan’s Law states that the complement of the union of two sets is equal to the intersection of the complements of the two sets.
venn2(subsets=(1, 1, 0), set_labels=labels)
plt.title("DeMorgan's Law")
plt.show()
Lets examine the ideas DeMorgans Law presents.
Quantification vs Complement
Quantification | Complement |
---|---|
All 5 | Not all 0, 1, 2, 3, 4 |
1,2,3,4,5 | Not some |
Are events mutually exclusive?
Depends on the problem.
Lets look at a deck of cards:
Deck of Cards
S = {52 cards} A = {red cards} B = {face cards} A and B = {red face cards}
Are A and B mutually exclusive?
No, because there are red face cards.
The intersection of A and B is not empty.