https://www.jianshu.com/p/16d160afd140
https://www.cnblogs.com/wangprince2017/p/9937341.html
p.adjust {stats}
Adjust P-values for Multiple Comparisons
Description
Given a set of p-values, returns p-values adjusted using one of several methods.
Usage
p.adjust(p, method = p.adjust.methods, n = length(p))
Arguments
p: numeric vector of p-values (possibly with NAs). Any other R object is coerced by as.numeric.
method: correction method. Can be abbreviated.p.adjust.methods # c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none")
n: number of comparisons, must be at least length(p); only set this (to non-default) when you know what you are doing!
Details
The adjustment methods include the Bonferroni correction ("bonferroni") in which the p-values are multiplied by the number of comparisons. Less conservative corrections are also included by Holm (1979) ("holm"), Hochberg (1988) ("hochberg"), Hommel (1988) ("hommel"), Benjamini & Hochberg (1995) ("BH" or its alias "fdr"), and Benjamini & Yekutieli (2001) ("BY"), respectively. A pass-through option ("none") is also included. The set of methods are contained in the p.adjust.methods vector for the benefit of methods that need to have the method as an option and pass it on to p.adjust.
The first four methods are designed to give strong control of the family-wise error rate. There seems no reason to use the unmodified Bonferroni correction because it is dominated by Holm's method, which is also valid under arbitrary assumptions.
Hochberg's and Hommel's methods are valid when the hypothesis tests are independent or when they are non-negatively associated (Sarkar, 1998; Sarkar and Chang, 1997). Hommel's method is more powerful than Hochberg's, but the difference is usually small and the Hochberg p-values are faster to compute.
The "BH" (aka "fdr") and "BY" method of Benjamini, Hochberg, and Yekutieli control the false discovery rate, the expected proportion of false discoveries amongst the rejected hypotheses. The false discovery rate is a less stringent condition than the family-wise error rate, so these methods are more powerful than the others.
Note that you can set n larger than length(p) which means the unobserved p-values are assumed to be greater than all the observed p for "bonferroni" and "holm" methods and equal to 1 for the other methods.
Value
A numeric vector of corrected p-values (of the same length as p, with names copied from p).
該函數表達的意思是這樣的:
- 我們將一系列p值、校正方法(BH)以及所有p值的個數(length(p))輸入到p.adjust函數中。
- 將一系列的p值按照從大到小排序,然后利用下述公式計算每個p值所對應的FDR值。 公式:p * (n/i), p是這一次檢驗的p value,n是檢驗的次數,i是排序后的位置ID(如最大的P值的i值肯定為n,第二大則是n-1,依次至最小為1)。
- 將計算出來的FDR值賦予給排序后的p值,如果某一個p值所對應的FDR值大於前一位p值(排序的前一位)所對應的FDR值,則放棄公式計算出來的FDR值,選用與它前一位相同的值。因此會產生連續相同FDR值的現象;反之則保留計算的FDR值。
- 將FDR值按照最初始的p值的順序進行重新排序,返回結果。
STAMP中多重檢驗的p值校正
Benjamini 屬於FWER α值除以檢驗次數,太嚴格,一般不用
Benjamini-Hochberg FDR 應用較多
Storey’s FDR
Sidak
如何理解Family-wise error rate(FWER)和False discovery rate(FDR)
https://www.sohu.com/a/165109778_785442
http://www.360doc.com/content/18/0914/21/19913717_786724085.shtml
https://zhuanlan.zhihu.com/p/26229438
假設檢驗是用於檢驗統計假設的一種方法。它的基本思想是小概率思想,小概率思想是指小概率事件在一次試驗中基本上不會發生。
一次檢驗有四種可能的結果,會犯兩類錯誤,
I類錯誤(α )棄真:是指空假設為真卻被我們拒絕的情況,犯這種錯誤的概率用α表示
II類錯誤(β)取偽:是指空假設為假但我們沒有拒絕的情況,犯這種錯誤的概率用β表示
在做假設檢驗時,只控制I類錯誤,即α。
多重假設檢驗就是(同一數據集下)進行多次假設檢驗。舉個例子,一台大米包裝機,正常工作時生產的袋裝大米的質量符合正態分布,某次質檢員抽一袋稱重,判斷機器是否正常運行。
如果有抽m台機器,那么就需要進行m次假設檢驗。
在一次假設檢驗中,我們使用顯著性水平α或p值得出結論,可以保證一次假設檢驗中犯I類錯誤的概率和決策錯誤的風險小於α。
但是在 m次假設檢驗中,假設檢驗之間相互獨立,站在質檢員角度(multiple test),檢驗結果錯誤(至少1次錯誤)的概率增大,遠大於α,站在每台機器的角度(single test),I類錯誤仍然是α 。
所以,對於多重檢驗,如果不進行任何控制,犯一類錯誤的概率便會隨着假設檢驗的個數迅速增加。
為了使多重假設檢驗整體犯I類錯誤的概率低於預先設定的顯著性水平α ,往往采用FWER和FDR校正。
FWER和FDR表示一種概念或一種方法,FWER定義為多重假設檢驗中發現至少一個I類錯誤的概率,FDR定義為多重假設檢驗中錯誤發現占所有發現的比例(棄真/棄真+取偽)。另外,對應地,還存在FWER校正方法和FDR校正方法(也稱為控制方法)。兩類校正方法都是用來控制多重假設檢驗中犯I類錯誤的概率,使其低於顯著性水平α。FWER校正有多種實現,其中最經典的是Bonferroni correction;FDR校正也有多種實現,其中最經典的就是Benjamini–Hochberg procedure。
FWER顯得較為保守,它主要是依靠減少假陽性的個數,同時也會減少TDR(true discovery rate)。
Bonferroni correction 只要pi ≤α/m ,就拒絕Hi
FDR方法是一種更加新穎靠譜的方法,它會對每個測試用例使用校正后的p 值,達到了更好的效果:在檢驗出盡可能多的陽性結果的同時將錯誤發現率控制在可以接受的范圍。
BH進行了p值排序,它校正有效的條件是要求m個檢驗是相互獨立的。
總體錯誤率(family wise error rate,FWER)定義為至少犯一次I型錯誤的概率。常用的總體錯誤率控制程序包括Bonferroni、Holm、Hochberg和Hommel等方法,但總體錯誤率控制過於嚴格,並不適合大規模數據的多重比較,隨着檢驗次數m的增加,總體錯誤率的效能明顯降低。
錯誤發現率(False Discovery Rate, FDR)是錯誤拒絕(拒絕真的原假設)的個數占所有被拒絕的原假設個數的比例的期望值。