---
# System prepended metadata

title: CH 1
tags: [機率]

---

<style>
    /* 頁面整體設定 */
    html, body, .ui-content {
    background: #2C2C2C;
    color: #DFDCFF;
}
    table{
        color: #4B0082;
    }
    /* tag顏色設定 */
.markdown-body h6 {
    font-size: .85em;
    color: #A5FFE5;
    -webkit-animation: discolor 5s linear infinite,
                      glint 2s ease infinite;
          animation: discolor 5s linear infinite,
                      glint 2s ease infinite;
    /*animation: discolor 5s linear infinite,
               glint 2s ease infinite;*/
}   
    /* 設定右上角留言按鈕 */
#comment-app .open-comments {
    background: transparent;
}
.btn-default {
  background: transparent;
  border-color: #A5FFE599;
    -webkit-animation: discolor 5s linear infinite,
                      glint 2s ease infinite;
          animation: discolor 5s linear infinite,
                      glint 2s ease infinite;
}
.btn-default:hover {
  background: transparent;
}
.ui-comment-app .open-comments .btn.ui-open-comments {
  color: #A5FFE599;
}
.ui-comment-app .open-comments .btn.ui-open-comments:hover {
  color: #A5FFE5;
}
    /* 設置愛心、收藏、小鈴鐺按鈕 */
.community-button {
  color: #A5FFE580;
    -webkit-animation: discolor 5s linear infinite,
                      glint 2s ease infinite;
          animation: discolor 5s linear infinite,
                      glint 2s ease infinite;
}
.community-button:hover {
  color: #A5FFE5;
  background: transparent;
}
    /* 設定 code 模板 */
    .markdown-body code,
.markdown-body tt {
    background-color: #ffffff36;
}
.markdown-body .highlight pre,
.markdown-body pre {
    color: #ddd;
    background-color: #00000080;
}
.hljs-tag {
    color: #ddd;
}
.token.operator {
  background-color: transparent;
}
    /* h1, h2 樣式 */
.markdown-body h1,
.markdown-body h2 {
    border-bottom-color: #ffffff80;
    text-shadow: 3px 3px 3px #9370DB;
}

    /* 設定小目錄的背景顏色 */
.ui-toc-dropdown {
    background-color: #2C2C2C;
}
    /* 設定行動裝置中，小目錄按鈕 */
.ui-toc-label.btn {
    background: linear-gradient(180deg, #2BE8CF60 0%, #2B83E860 100%);
    color: #ffffff90;
}
.ui-toc-label.btn:hover {
    background: linear-gradient(180deg, #2BE8CF90 0%, #2B83E890 100%);
    color: #ffffff;
}
    /* 設定小目錄內連結 */
.ui-toc-dropdown .nav>li>a,
.toc-menu>a {
    color: #D4F9FF;
    font-weight: bold;
}
.ui-toc-dropdown .nav>li>a:focus,
.ui-toc-dropdown .nav>li>a:hover {
    color: #00FFD5;
    border-left: 1px solid #00FFD5;
}

.ui-toc-dropdown .nav>.active:focus>a,
.ui-toc-dropdown .nav>.active:hover>a,
.ui-toc-dropdown .nav>.active>a {
    color: #00FFD5;
    border-left: 1px solid #00FFD5;
/*     -webkit-animation: discolor 5s linear infinite,
                        glint 2s ease infinite;
            animation: discolor 5s linear infinite,
                        glint 2s ease infinite; */
}

.toc-menu>a:focus,
.toc-menu>a:hover {
    color: #00FFD5;
}
    /* 回到最上面的按鈕 */
.markdown-body a > .fa-chevron-up {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 4px;
    border-radius: 4px;
    color: #fff;
    background: linear-gradient(180deg, #2BE8CF60 0%, #2B83E860 100%);
}
.markdown-body a:hover > .fa {
    background: linear-gradient(180deg, #2BE8CF95 0%, #2B83E895 100%);
    -webkit-animation: discolor 5s linear infinite,
                        glint 2s ease infinite;
            animation: discolor 5s linear infinite,
                        glint 2s ease infinite;
}
    /* 右邊滾動軸 */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #2BE8CF60 0%, #2B83E860 100%);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #2BE8CF95 0%, #2B83E895 100%);
}
    /* 設定連結 */
a,
.open-files-container li.selected a {
    color: #89FFF8;
    
}
a:hover,
.open-files-container li.selected a:hover {
    color: #89FFF8;
}
    /* 上面的名字顏色修改 */
.text-gray-900 {
    --tw-text-opacity: 1;
    color: #95FFFF;
    animation: discolor 5s linear infinite,
               glint 2s ease infinite;
}

/* 下面的名字顏色修改 */
/* 這個會修改到最下面的HackMD 但不會閃爍*/   
.footer a {
    color: #95FFFF;
}
.text-black-brand {
    --tw-text-opacity: 1;
    animation: discolor 5s linear infinite,
               glint 2s ease infinite;
}
/* 動畫 */
@keyframes discolor {
    0%, 100% {filter: hue-rotate(0);}
    50% {filter: hue-rotate(180deg);}
}
</style>

###### tags: `機率`

# CH 1

## Stem-and-Leaf Display

ex. 
167, 155, 167, 158, 163, 175, 173, 182, 177
sort : 155, 158, 163, 167, 167, 173, 175, 177, 182
stem : 百位和十位，leaf : 個位數


| stem | leaf |
| -------- | -------- |
| 15    | 58     |
| 16    | 377     |
| 17    | 357    |
| 18    | 2    |

## Dotplots(點點圖)

- 適合用在資料集少，不同的值少的情況

![](https://i.imgur.com/rO9HlId.png)

## Histograms(~~方方圖~~)
### 簡介
- x軸為出現的數值
- y軸為數值出現的relative frequency
- relative frequency = $\frac{數值出現次數}{總共有多少數值}$

![](https://i.imgur.com/LeECu1P.png)



### 觀察

1. 峰值


| ![](https://i.imgur.com/t2OSvd7.png) | ![](https://i.imgur.com/fq2Xe3o.png) |
|:------------------------------------:|:------------------------------------:|
|               一個峰值               |               兩個峰值               |

2. 歪斜

- 左長 $\rightarrow$ 負 (左圖)
- 右長 $\rightarrow$ 正 (右圖)

| ![](https://i.imgur.com/jzseGiK.png) | ![](https://i.imgur.com/uAzMOkj.png) | ![](https://i.imgur.com/D1u39Mn.png) |
|:------------------------------------:|:------------------------------------:|:------------------------------------:|
|          negatively skewed           |              symmetric               |          positively skewed           |

## Mean ($\mu$)
- 平均值
- sample mean ( $\bar{x}$ )

### trimmed mean
x% trimmed mean 就是將最小的x%的資料和最大的x%資料刪除之後算平均。
ex.
~~1~~, 2, 6, 7, 7, 9, 11, 11, ~~19~~
$\bar{x}$ tri(10) = (2 + 6 + 7 + 7 + 9 + 11 + 11) / 8 = 8

## Median ($\tilde{\mu}$)
- 中位數
- sample median ( $\tilde{x}$ )
- 若資料數為奇數，median = 第$\frac{n+1}{2}$個資料
- 若資料數為偶數，median = 第$\frac{n}{2}$和$\frac{n}{2}$+1個資料的平均
- mean和median的關係

| ![](https://i.imgur.com/zeAut9A.png) | ![](https://i.imgur.com/IRo7znp.png) | ![](https://i.imgur.com/ZjzDRTF.png) |
|:------------------------------------:|:------------------------------------:|:------------------------------------:|
|            negative skew             |              symmetric               |            positive skew             |
## Measures of Variability ($\sigma ^ 2$)

- 變異數

### $\sigma ^ 2$ = $\cfrac{\sum ^ {N}_{i=1} (x_i - \mu) ^ 2}{N}$

### standard deviation ( $\sigma$ )
- 標準差
- $\sigma = \sqrt{\sigma^2}$

### sample variance($S^2$)
- $S^2$ = $\cfrac{\sum ^ {n}_{i=1} (x_i - \mu) ^ 2}{n - 1}$ = $\cfrac{S_{xx}}{n - 1}$
- $S_{xx}$ : 離差平方和 ( $\sum ^ {n}_{i=1} (x_i - \mu) ^ 2$ )

## Boxplots

### 要標示出的五點
1. smallest : 最小值
2. lower fourth : 左半邊的中位數
3. median : 中位數
4. upper fourth : 右半邊的中位數
5. largest : 最大值

ex.
1, 3, 4, 6, 10, 13, 15, 16, 16, 20, 25
![](https://i.imgur.com/2heMamq.png)

### <i class="	fa fa-star"></i> Show Outliers
- 線要畫到不是outlier的最後一個點
- fs = upper fourth - lower fourth
- mild outlier : 在upper fourth或lower fourth以外的1.5fs ~ 3fs，用實心圓標示
- extreme outlier : 在upper fourth或lower fourth以外的3fs外，用空心圓標示

![](https://i.imgur.com/G1BITJJ.png)



## Edit Record

2023/04/04