0 0 1 0 1 0 1 1 0 0
Probability and Statistics
Kyiv School of Economics
50% chance of heads
50% chance of tails
Let’s a head as a success (1
) and a tail as a failure (0
).
0 0 1 0 1 0 1 1 0 0
1 0 1 0 0 1 0 0 0 0
5
6 6 7 6 4 4 6 7 6 6
9 9 8 9 9 5 9 8 9 9
1 3 2 2 2 3 4 0 3 0
A probability distribution is a mathematical description of the possible outcomes of a random variable.
\[X_{1 \times n} \sim \text{Binomial}(\text{size}, p)\]
\[X \sim \text{Binomial}(10, 0.5)\]
\[\text{Pr}(X = 5)\]
Let’s simulate this:
\[\hat{\text{Pr}}(X = x) = \frac{1}{n} \sum_{i=1}^{n} I(X_i = x)\]
\[\text{Pr}(X = x) = \frac{n!}{x! \times (n - x)!} \times p^x \times (1 - p)^{n - x}\]
\[\text{Pr}(X = 5) = \frac{10!}{5! \times 5!} \times 0.5^5 \times 0.5^5 = \]
0.2460938
Factorial
\(n! = n \times (n - 1) \times \ldots \times 1\)
\[X \sim \text{Binomial}(10, 0.5)\]
\[\text{Pr}(X \leq 4)\]
\(\hat{\text{Pr}}(X \leq 4) =\) 0.3791
\(\text{Pr}(X \leq x) = \sum_{i=0}^{x} \text{Pr}(X = i)\)
\(\text{Pr}(X \leq 4) = \sum_{i=0}^{4} \text{Pr}(X = i) =\) 0.3769531
\[X \sim \text{Binomial}(\text{size}, p)\]
\[\text{E}(X) = \text{size} \times p\]
The mean of our sample distribution is 4.9956.
If we try to find mean of the sample with size = 100
and prob = 0.2
: 20.0495.
\(X \sim \text{Binomial}(10, 0.5)\)
\(\text{Var}(X) = \text{size} \times p \times (1 - p)\)
\(\text{Var}(X) = 10 \times 0.5 \times (1 - 0.5) = 2.5\)
\(Y \sim \text{Binomial}(100, 0.2)\)
\(\text{Var}(Y) = 100 \times 0.2 \times (1 - 0.2) = 16\)
\[X \sim \text{Binomial}(\text{size}, p)\]
\[\text{E}(X) = \text{size} \times p\]
\[\text{Var}(X) = \text{size} \times p \times (1 - p)\]
\(A = 1\)
\(A = 0\)
\(A = 1\)
\(A = 0\)
\(B = 1\)
\(B = 0\)
flowchart LR A["Start"] -->|"Pr(A)"| B["A = 1"] A -->|"1 - Pr(A)"| C["A = 0"] B -->|"Pr(B)"| D["B = 1"] B -->|"1 - Pr(B)"| E["B = 0"] C -->|"Pr(B)"| F["B = 1"] C -->|"1 - Pr(B)"| G["B = 0"] D --> H["A = 1, B = 1"] E --> I["A = 1, B = 0"] F --> J["A = 0, B = 1"] G --> K["A = 0, B = 0"]
\[\text{Pr}(A \text{ and } B) = \text{Pr}(A) \times \text{Pr}(B)\]
\[ \text{Pr}(A \text{ and } B) = 0.5 \times 0.5 = 0.25\]
Note
For dependent events: \(\text{Pr}(A \text{ and } B) = \text{Pr}(A) \times \text{Pr}(B | A)\)
\[\text{Pr}(A \text{ or } B) = \text{Pr}(A) + \text{Pr}(B) - \text{Pr}(A \text{ and } B)\]
\[\text{Pr}(A \text{ or } B) = \text{Pr}(A) + \text{Pr}(B) - \text{Pr}(A \times B)\]
\[\text{Pr}(A \text{ or } B) = 0.5 + 0.5 - 0.25 = 0.75\]
\[ \begin{aligned} \text{Pr}(A \text{ or } B \text{ or } C) &= \text{Pr}(A) + \text{Pr}(B) + \text{Pr}(C) \\ &- \text{Pr}(A \text{ and } B) - \text{Pr}(A \text{ and } C) - \text{Pr}(B \text{ and } C) \\ &+ \text{Pr}(A \text{ and } B \text{ and } C) \end{aligned} \]
\[X \sim \text{Binomial}(10, 0.5)\]
\[Y \sim 3 \times X\]
\(E[k \times X] = k \times E[X]\)
\(Var[k \times X] = k^2 \times Var[X]\)
\[X \sim \text{Binomial}(10, 0.5)\]
\[Y \sim \text{Binomial}(100, 0.2)\]
\[Z \sim X + Y\]
\[E[X + Y] = E[X] + E[Y]\]
\[Var[X + Y] = Var[X] + Var[Y]\]
50k fair coins
50k unfair coins
20 flips each
14 heads
6 tails
Which pile did the coin come from?
\(\text{Pr}(\text{Biased | 14 heads}) = \frac{\text{biased w/ 14 heads}}{\text{total w/ 14 heads}} = \frac{8356}{1903 + 8356} =\) 0.8145043
\(\text{Pr}(\text{Biased | 14 heads}) = \frac{\text{biased w/ 14 heads}}{\text{total w/ 14 heads}} = \frac{1698}{1698 + 3440} =\) 0.3304788
\[ \text{Pr}(\text{Biased | 14 heads}) = \frac{\text{Pr}(\text{14 heads and Biased})}{\text{Pr}(\text{14 heads and Biased}) + \text{Pr}(\text{14 heads and Fair})} \\ = \frac{\text{Pr}(\text{14 heads | Biased}) \times \text{Pr}(\text{Biased})}{\text{Pr}(\text{14 heads | Biased}) \times \text{Pr}(\text{Biased}) + \text{Pr}(\text{14 heads | Fair}) \times \text{Pr}(\text{Fair})} \]
\[ \text{Pr}(\text{A | B}) = \frac{\text{Pr}(\text{B | A}) \times \text{Pr}(\text{A})}{\text{Pr}(\text{B})} \]
\[ \text{A} = \text{Biased}, \text{B} = \text{14 heads} \]
Flipping a Coin 10 times
Flipping a Coin 1000 times
\[X \sim \text{Normal}(\mu, \sigma)\]
\[\sigma = \sqrt{\text{Var}(X)}\]
\[\mu = \text{size} \times p\]
\[\sigma = \sqrt{\text{size} \times p \times (1 - p)}\]
Flipping many conis, each with low probability of heads
\[X \sim \text{Binomial}(1000, 1 / 1000)\]
This particular case of the binomial, where \(n\) is large and \(p\) is small, can be approximated by the Poisson distribution.
\[X \sim \text{Poisson}(\lambda)\]
Probability and Statistics