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:藥有差異

可能產生的結果:

  1. p-value<0.05
    • reject H_0 ; support H_A
    • A is different from B
  2. 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:

  1. 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)
  2. 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

  1. 計算連續擲出正面的機率下p-value

p-value 由三個部分組成

  1. 隨機觀察時發生的機率 兩個正面的機率=0.25
  2. 同樣罕見的機率 兩個反面的機率跟兩格正面的機率一樣罕見所以兩個反面的0.25也需計算
  3. 比0.25還罕見的機率 由於一個正面一個反面機率是0.5並不比0.25罕見故比0.25罕見的機率是0

p-value=0.25+0.25+0=0.5

  1. 計算擲出4次正面1次反面 的 p-value
  1. 都是正面→1種排序
  2. 一個反面→5種排序
  3. 兩個反面→10種排序
  4. 三個反面→10種排序
  5. 四個反面→5種排序
  6. 都是反面→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

  1. calculate probabilities and p-values for how tall or short people are?
    1. use statistical distribution (統計分佈) image.png
    2. 利用p-value 計算 142cm來自哪個distribution image.png
      1. p-value for 142cm given the blue distribution
        1. 0.025+0.025=0.05
        2. 0.05=0.05
        3. maybe it could be come from blue distribution, maybe not. it’s hard to tell since the p-value is right on the borderline.
      2. p-value for 141cm given the blue distribution
        1. 0.016+0.016=0.03
        2. 0.03<0.05
        3. 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.
      3. p-value for 155.4-156cm given the blue distribution
        1. 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 與中值 距離是遠的)
        2. p-value =0.04(155.4-156cm)+0.48(area<155.4cm)+0.48(area>156cm)=1
        3. 1>0.05 reject H_0
        4. 並不表示該假設不成立於其他常態分佈,也可能成立於其他常態分佈
  2. one side p-value v.s. two side p-value 假設檢定 one side p-value 只關心一個方向的變化 用於檢測「是否顯著大於或小於」,只考慮一側。 two side p-value 關心是否有變化(無論方向性) 用於檢測「是否有顯著差異」,考慮雙側。
    1. one side p-value
      1. 一家公司開發了一種新藥,希望證明它的效果比現有藥物 更好(而不是單純不同)。
        1. H_0:新藥的平均療效mu ≤ 舊藥的平均療效 mu_0
        2. H_1:新藥的平均療效mu > 舊藥的平均療效 mu_0
        3. p-value<0.05 → reject H_0 ; support H_1
      2. 一家工廠的機械零件壽命標準為 1000 小時,但最近懷疑新批次的零件壽命較低,希望檢驗是否顯著低於標準
        1. H_0:零件平均壽命 mu ≥ 1000 小時
        2. H_1:零件平均壽命  \mu  < 1000 小時 (只關心「變低」,所以是左尾檢定
    2. two side p-value
      1. 學生的考試成績是否與去年不同?(可能變高或變低)
      2. 新產品的銷售額是否與舊產品不同?(可能增加或減少)
    3. compare one side p-value and two side p-value image.png
      1. 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
      b. one side p-value=0.016 0.016<0.05 reject H_0: no different for recovery support H_1: have different for recovery image.png 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

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:

  1. 紅酒與長壽 某研究發現每天喝一杯紅酒能延長壽命(p < 0.05),但後來發現研究者其實測試了 20 種不同的飲食習慣,只有紅酒的結果達標,其他 19 個測試都沒有發表。這種作法屬於典型的 P-hacking
  2. 股票市場與滿月 一位分析師測試了 月亮週期對股市的影響,結果發現滿月期間股價上升的 p 值為 0.04。但其實他測試了 200 種不同的經濟變數,最後選擇一個剛好達標的結果發表,這也是 P-hacking。 what cause the p-hacking
    1. 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 image.png how to avoid this problem find the method that compensates for multiple testing
      1. 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.
      </aside>
    2. Data Manipulation(add/delete data)

<aside>

if p-value is close to 0.05 but not less than,so we add more data

</aside>

「tsao」的個人頭像

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *