你的購物車目前是空的!
p-values
p-values: What they are and how to interpret them
learning from: https://www.youtube.com/watch?v=vemZtEM63GY&t=14s
p-value(p 值)是一個統計指標,表示在零假設(H_0)為真時,觀察到目前數據或更極端數據的機率。它用來衡量數據與零假設的相符程度。
p 值幫助我們決定是否要拒絕零假設。在統計檢定中,我們通常有:
H_0**(零假設null hypothesis):** 假設沒有顯著差異或效果(如「新藥對病人無影響」)。
H_A**(對立假設):** 假設有顯著差異或效果(如「新藥對病人有效」)。
如果 p 值很小,代表觀察到的結果「不太可能」只是機率造成的,這可能意味著應該
拒絕 H_0,支持 H_A。
換言之。我們希望數據具統計意義的情況下p-value<0.05. (5%),這種狀況下表示結果不是random chance 產生的>>>reject H_0 ; support H_A
ex:在藥物對治療有無效果的假設中
據統計意義的情況下我們是希望的
藥物是有效果的,所以我們期望的是reject H_0 ; support H_A
那這樣狀況下我們的假設定義即為:
- H_0:藥沒有效果
- H_A:藥有效果
ex:在藥物A/B 有無差異假設中
- H_0:藥沒有差異
- H_A:藥有差異
可能產生的結果:
- p-value<0.05
- reject H_0 ; support H_A
- A is different from B
- p-value>0.05
- support H_0 ; reject H_A
- A is no different from B
以上假說只能支持兩種藥物具備差異性,無法支持藥物是否有效
那假設一樣的藥物下:
p-value > 0.05是必然的,因為是一樣的藥物
但是結果卻是顯示p-value < 0.05 → 表示 具備 random chance 的可能性(有exrtrme data)
此時稱為false positive(假陽性)
p-value<0.05 just tell us → A is dofferent from B; does tell us HOW different
so even p-value is small the different colod be tiny or huge
ex:
- drug_A have 37% cured ; drug_B have 31%cured ; p-value =0.24 (in small sample data) p-value > 0.05→ no different (even there is an 6% different)
- drug_A have 34% cured ; drug_B have 35%cured ; p-value =0.04 (in large sample data) p-value < 0.05→ different (even there is just an 1% different)
How to calculate p-values
learning from: https://www.youtube.com/watch?v=JQc3yx0-Q9E
硬幣連續擲出正面→硬幣是否跟正常硬幣是一樣的
H_0 : coin no different from coin_normal
H_A : coin different from coin_normal
p-value<0.05 →reject H_0 ; support H_A
p-value : determined by adding up probabilities
- 計算連續擲出正面的機率下p-value
p-value 由三個部分組成
- 隨機觀察時發生的機率 兩個正面的機率=0.25
- 同樣罕見的機率 兩個反面的機率跟兩格正面的機率一樣罕見所以兩個反面的0.25也需計算
- 比0.25還罕見的機率 由於一個正面一個反面機率是0.5並不比0.25罕見故比0.25罕見的機率是0
p-value=0.25+0.25+0=0.5
- 計算擲出4次正面1次反面 的 p-value
- 都是正面→1種排序
- 一個反面→5種排序
- 兩個反面→10種排序
- 三個反面→10種排序
- 四個反面→5種排序
- 都是反面→1種排序
有32種可能
總共1+5+10+10+5+1=32
4次正面1次反面 的 p-value
p-value = 5/32(一個反面)+5/32(四個反面)+1/32(都是正面)+1/32(都是反面)=0.375
0.375>0.05 fail reject H_0
coin no different from coin_normal
- calculate probabilities and p-values for how tall or short people are?
- use statistical distribution (統計分佈)
- 利用p-value 計算 142cm來自哪個distribution
- p-value for 142cm given the blue distribution
- 0.025+0.025=0.05
- 0.05=0.05
- maybe it could be come from blue distribution, maybe not.
it’s hard to tell since the p-value is right on the borderline.
- p-value for 141cm given the blue distribution
- 0.016+0.016=0.03
- 0.03<0.05
- reject H_0: it is normal to measure someone 141 cm tall that given the blue distribution.(此數值與藍色常態分佈沒有差異) maybe which come from green distribution is makes more sense.
- p-value for 155.4-156cm given the blue distribution
- H_0: is s measurement between 155.4 and 156 so far away from the mean of the blue distribution (155.5cm). (155.4-156cm 與中值 距離是遠的)
- p-value =0.04(155.4-156cm)+0.48(area<155.4cm)+0.48(area>156cm)=1
- 1>0.05 reject H_0
- 並不表示該假設不成立於其他常態分佈,也可能成立於其他常態分佈
- p-value for 142cm given the blue distribution
- use statistical distribution (統計分佈)
- one side p-value v.s. two side p-value 假設檢定 one side p-value 只關心一個方向的變化 用於檢測「是否顯著大於或小於」,只考慮一側。 two side p-value 關心是否有變化(無論方向性) 用於檢測「是否有顯著差異」,考慮雙側。
- one side p-value
- 一家公司開發了一種新藥,希望證明它的效果比現有藥物 更好(而不是單純不同)。
- H_0:新藥的平均療效mu ≤ 舊藥的平均療效 mu_0
- H_1:新藥的平均療效mu > 舊藥的平均療效 mu_0
- p-value<0.05 → reject H_0 ; support H_1
- 一家工廠的機械零件壽命標準為 1000 小時,但最近懷疑新批次的零件壽命較低,希望檢驗是否顯著低於標準。
- H_0:零件平均壽命 mu ≥ 1000 小時
- H_1:零件平均壽命 \mu < 1000 小時 (只關心「變低」,所以是左尾檢定)
- 一家公司開發了一種新藥,希望證明它的效果比現有藥物 更好(而不是單純不同)。
- two side p-value
- 學生的考試成績是否與去年不同?(可能變高或變低)
- 新產品的銷售額是否與舊產品不同?(可能增加或減少)
- compare one side p-value and two side p-value
- two side p-value=0.016+0.016=0.03 0.03<0.05 reject H_0: no different for recovery support H_1: have different for recovery however → maybe some other distribution does a better job explaning the data
c. one side p-value=0.016
0.98>0.05 support H_0: no different for recovery reject H_1: have different for recovery
- one side p-value
p-hacking: What it is and how to avoid it!
P-hacking(p 值操控)是指研究者 透過操控數據分析方式,來獲得統計上顯著(通常 p < 0.05 )的結果,而非真正具備科學意義的發現。這種行為可能是 無意識的選擇性報告,也可能是 刻意操控 來誤導讀者或審查者。
P-hacking refers to the misuse and abuse of analysis techniques and results in being fooled by false positives.
example:
- 紅酒與長壽 某研究發現每天喝一杯紅酒能延長壽命(p < 0.05),但後來發現研究者其實測試了 20 種不同的飲食習慣,只有紅酒的結果達標,其他 19 個測試都沒有發表。這種作法屬於典型的 P-hacking。
- 股票市場與滿月 一位分析師測試了 月亮週期對股市的影響,結果發現滿月期間股價上升的 p 值為 0.04。但其實他測試了 200 種不同的經濟變數,最後選擇一個剛好達標的結果發表,這也是 P-hacking。 what cause the p-hacking
- multiple testing problem <aside> ex: All data from the same distribution We test drug A-Z and ramdon 3 sample for this distribution it will cause the multiple testing problem
how to avoid this problem find the method that compensates for multiple testing
- False Discovery Rate (FDR) create the FDR and input all the p-value ,this function will output the p-value which is bigger than the origial p-value to avoid the False Positive.
- Data Manipulation(add/delete data)
- multiple testing problem <aside> ex: All data from the same distribution We test drug A-Z and ramdon 3 sample for this distribution it will cause the multiple testing problem
<aside>
if p-value is close to 0.05 but not less than,so we add more data
</aside>
發佈留言