統計學入門
George Boorman
Curriculum Manager, DataCamp
事件的機率是什麼?
$$ P(\text{event}) = \frac{\text{事件可能發生的方式數}}{\text{所有可能結果的總數}} $$
例:擲硬幣
$$ P(\text{heads}) = \frac{\text{出現正面的 1 種方式}}{\text{2 種可能結果}} = \frac{1}{2} = 50\%$$



$$P(\text{Brian}) = \frac{1}{4} = 25\%$$


$$P(\text{Brian}) = \frac{1}{4} = 25\%$$
若兩個事件互為獨立,第二個事件的機率不會因第一個事件的結果而改變。
| Order Number | Product Type | Net Quantity | Gross Sales | Discounts | Returns | Net Sales |
|---|---|---|---|---|---|---|
| 200 | Basket | 13 | 3744.0 | -316.80 | 0.00 | 3427.20 |
| 201 | Basket | 12 | 3825.0 | -201.60 | -288.0 | 3335.40 |
| 202 | Basket | 17 | 3035.0 | -63.25 | 0.00 | 2971.75 |
| 203 | Art & Sculpture | 47 | 2696.8 | -44.16 | 0.00 | 2652.64 |
| 204 | Basket | 17 | 2695.0 | -52.50 | -110.00 | 2532.50 |

| Product Type | Order Count |
|---|---|
| Basket | 551 |
| Art & Sculpture | 337 |
| Jewelry | 210 |
| Kitchen | 161 |
| Home Decor | 131 |
| ... | ... |
| Total | 1767 |
$$P(Jewelry) = \frac{Order \ Count(Jewelry)}{Sum(Total \ Order \ Count)}$$
$$P(Jewelry) = \frac{210}{1767}$$
$$P(Jewelry) = 11.88 \%$$
| Product Type | Order Count | Probability |
|---|---|---|
| Basket | 551 | 31.18% |
| Art & Sculpture | 337 | 19.07% |
| Jewelry | 210 | 11.88% |
| Kitchen | 161 | 9.11% |
| Home Decor | 131 | 7.41% |
| ... | ... | ... |
| Total | 1767 | 100% |
統計學入門