---
# System prepended metadata

title: Stat03
tags: [Stat]

---

---
title: Stat03
tags: Stat
---




![](https://i.imgur.com/zJPrIF8.jpg)
![](https://i.imgur.com/6Q689pj.jpg)
![](https://i.imgur.com/uBluFcR.jpg)
![](https://i.imgur.com/rGlTJcC.jpg)
---

### Original definition of the probability of a simple event

#### Example of tossing a coin. 


We would like to know the probability of getting a head. 
Simple events:
$H$: a head,
$T$: tail,
Sample space: $S=\{H, T\}$


In reality, suppose we toss the coin 10 times, we observe $HHHTTTHTHH$.



1. The *relative frequency* (相對頻率,比例) of observing a head is 
$$\frac{f}{n}=\frac{6}{10}=60\%.$$
2. The *probability* of observing a head is
$$P(H)=\lim_{n\rightarrow \infty}\frac{f}{n}.$$

:::success
Human beings start to explore the idea of limit in calculus. 
:::





### Examples of interpreting a probability 

---
#### Example 1.

Suppose a fair coin is tossed. The *probability of getting a head* is 50\%.

Interpretations: In *repeated sampling* (tossing a coin for infinitely times), a head is obtained for *about* 50\% of the times.  


---

#### Example 2. 
How do you interpret the probability of rain on Friday is 40\%? 

Interpretations: In *repeated sampling*, *about* 40\% of the days will rain. 

![](https://i.imgur.com/k3VnpPU.jpg)


---

#### Probability Axiom to calculate a Probability

##### Toss a Coin

Suppose we toss a fair coin. Sample space, $S = \{H, T\}$. 

(1). $P(H)=P(T)$.
(2). $P(S) = 1$.
(3). $P(S) = P(H)+P(T)$
(4). $P(S) \stackrel{(3)}{=} P(H)+P(T) \stackrel{(2)}{=} 1 \stackrel{(1)}{=} 2P(H)$
(5). $P(H) = 1/2$. 


---
#### $P^n_r$, 排列數

An application of the $MN$ rule:
\begin{eqnarray*}
P^n_r &=& (n)\times (n-1)\times\cdots \times (n-r+1)\\
&=& (n)\times (n-1)\times\cdots  \times (n-r+1)\times \frac{(n-r)\times (n-r-1)\times\cdots\times 1}{(n-r)\times (n-r-1)\times\cdots 1}\\
&=& \frac{n!}{(n-r)!}.
\end{eqnarray*}

---
#### Example. (orders matter!)

A box contains six M&Ms®, four red and two green. A child selects two M&Ms at random. What is the probability that exactly one is red?



Sol: 

Suppose order matter! Let $A$ denote the note that exactly one is red. 

Suppose orders of these two M&Ms matter.
$$\# S = P^{6}_2 =\frac{6!}{(6-2)!}= 30.$$

The number of exactly one red M&M: 
$$\#A = 2\times 4 + 4\times2 = 16.$$

$$P(A)=\frac{\# A}{\# S} = \frac{16}{30}=\frac{8}{15}.$$




---

#### $C^n_r$, 組合數

\begin{eqnarray*}
C^{n}_r & =& \frac{P^n_r}{r!}=\frac{ \frac{n!}{(n-r)!}}{r!}=\frac{n!}{(n-r)!r!}.
\end{eqnarray*}



---

#### Sets operations

1. union of $A$ and $B$: 聯集
2. intersection of $A$ and $B$: 交集 
3. complement of set $A$: 捕集 



--- 
#### $\phi$, an empty set

Let $\phi=\{\}$ denote the empty set. 

If two events are mutually exclusive, we write 
$$A\cap B = \phi. $$

$$P(\phi) = 0.$$

---

#### Another definition of independence

(1) $A$ and $B$ are independent if only if
1. $P(A|B) =P(A)$,
2. $P(B|A) = P(B)$.

From 1, we have
$$P(A|B)=\frac{P(A\cap B)}{P(B)} =P(A)=> P(A\cap B) = P(A)P(B) $$

From 2, we have
$$P(B|A)=\frac{P(B\cap A)}{P(A)}=P(B) => P(B\cap A)=P(A)P(B).$$


(2) $A$ and $B$ are independent, if and only if 
$P(A\cap B) =P(A)P(B)$. 


---
:::warning
Interpretations:
1. Confidence interval
2. Hypothesis test
:::


