單一樣本符號檢定 (One Sample Sign test)

套路9: 單一樣本符號檢定 (One Sample Sign test)

什麼是單一樣本假設檢定? 說白了就是只有一組資料做假設檢定。統計假設檢定檢定什麼?H0。例如單一樣本假設檢定H0 : median等於 0HA : median不等於0是檢定資料的平均值是否為0。又例如單一樣本假設檢定H0 : median 小於 8HA : median 大於等於 8是檢定資料的平均值是否小於8。假設相等時為雙尾 (two-tailed test) 檢定。假設不相等時為單尾 (one-tailed test) 檢定。如下圖所示:
1. 使用時機: 用於分析一組資料的中位數與期望值的差異
2. 分析類型: 無母數分析(non-parametric test)直接使用資料數值算統計叫parametric方法把資料排序之後用排序的名次算統計叫non-parametric方法。
3. 資料範例: 咪路測量招潮蟹大螯長度,資料如下:
招潮蟹
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
大螯長度(cm)
2.8
2.5
2.6
2.4
2.4
2.2
2.1
1.9
2.7
1.8
2.3
2.5
2.7
2.1
2.2
H0: 招潮蟹大螯長度中位數 = 2.5HA: 招潮蟹大螯長度中位數 2.5

第一步: 安裝BSDA程式套件
第二步: 呼叫BSDA程式套件備用
  library(BSDA)
第三步: 閱讀BSDA程式套件SIGN.test函數的說明書。
  help(SIGN.test)
第四步: 輸入建立資料。
   l <- c(2.8, 2.5, 2.6, 2.4, 2.4, 2.2, 2.1, 1.9, 2.7, 1.8, 2.3, 2.5, 2.7, 2.1, 2.2)
第五步: 使用BSDA程式套件SIGN.test函數代入資料diff
   SIGN.test(l, md = 2.5, alternative = "two.sided", conf.level = 0.95)
   # md = 2.5 H0:招潮蟹大螯長度中位數 = 2.5
   # alternative = "two.sided"執行雙尾檢定。
第六步: 判讀結果。
        One-sample Sign-Test
data:  l
s = 4, p-value = 0.2668
alternative hypothesis: true median is not equal to 2.5
95 percent confidence interval:
 2.117817 2.582183
sample estimates:
median of x   2.4
Achieved and Interpolated Confidence Intervals:
                  Conf.Level L.E.pt U.E.pt
Lower Achieved CI     0.8815 2.2000 2.5000
Interpolated CI       0.9500 2.1178 2.5822
Upper Achieved CI     0.9648 2.1000 2.6000
# p-value < 0.05H0: 招潮蟹大螯長度中位數 = 2.5,不成立。
# p-value > 0.05H0: 招潮蟹大螯長度中位數 = 2.5,成立。

來勁了嗎? 想知道更多?? 補充資料(連結):
2. 關於 Statistical hypothesis testing (https://en.wikipedia.org/wiki/Statistical_hypothesis_testing)
5. 關於R基礎,R繪圖及統計快速入門:
   b. Cookbook for R: http://www.cookbook-r.com/
   d. Statistical tools for high-throughput data analysis (STHDA): http://www.sthda.com/english/
e. The Handbook of Biological Statistics: http://www.biostathandbook.com/
f. An R Companion for the Handbook of Biological Statistics: http://rcompanion.org/rcompanion/index.html
6. Zar, JH. 2010. Biostatistical Analysis, Fifth Edition, Pearson.

留言

這個網誌中的熱門文章

統計不球人 目錄 (Table of Contents)

如何選擇統計方法 1

如何檢查資料是否接近常態分布 (Normality Test using R)