Coursera Inferential Statistics 筆記

上完 Basic Statistics 趁熱打鐵把 Inferential Statistics 也學(xué)習(xí)了。和上期一樣把一些遇到的問(wèn)題記錄一下。
Inferential Statistics 是在 Coursera - Methods and Statistics in Social Sciences Specialization - University of Amsterdam 里接著 Basic Statistics 的一門課程,這門課我打四星,難度加大也更深入。老師講得沒(méi)有 Basic Statistics 細(xì)致,有些地方需要自己另外找資料弄明白。而且視頻總是字幕和圖像對(duì)不上,只能當(dāng)練聽(tīng)力了。

Wilcoxon 秩和檢驗(yàn) - test statistic in R

Quiz 6 里有一題是這樣的

Image from: Coursera Inferential Statistics - Quiz 6

  1. sum of ranks in Wayne group
  2. sum of ranks in Astrophysics group
  3. test statistic in Wilcoxon rank sum test.

第一第二個(gè)問(wèn)題可以手算
rank sum Wayne = 19
rank sum Astrophysics = 17
理論上來(lái)說(shuō)當(dāng)每組樣本量相同時(shí), test statistic 為二者中較小的一個(gè),也就是17. 然后我就發(fā)現(xiàn)用R計(jì)算的W值并非 test statistic.
代碼如下:

rating <- c(2.5, 7.4, 7.2, 6.5, 8.0, 5.5, 3.2, 6.2)
group <- c('wayne', 'wayne', 'wayne', 'wayne', 'astro', 'astro', 'astro', 'astro')
wilcox.test(rating ~ group)

輸出結(jié)果為

    Wilcoxon rank sum test
data:  rating by group
W = 7, p-value = 0.8857
alternative hypothesis: true location shift is not equal to 0

其中W代表的是什么呢?
四處搜了一下,在這個(gè)論壇里找到解釋
Wilcoxon秩-和檢驗(yàn)結(jié)果的解讀中遇到問(wèn)題
這里的W是W統(tǒng)計(jì)量:第1組的秩和減去第1組秩和的數(shù)學(xué)期望值 n * (n+1)/2.

在R環(huán)境中,W = R - n * (n+1)/2.

所以本題中 W = 17 - 4 * (4+1)/2 = 7. test statistic = 17 并非7.
當(dāng)然我覺(jué)得這個(gè)題目有點(diǎn)tricky, 因?yàn)樵诼萏啬酻檢驗(yàn)中剛剛代碼里輸出的 W 值就是 U 值(Wilcoxon-Mann-Whitney as an alternative to the t-test)。

這兩個(gè)檢驗(yàn)方式的關(guān)系是:
Wilcoxon rank sum test = Mann Whitney U test

在 R 里面 U 檢驗(yàn)也是用的 wilcox.test(...) 的語(yǔ)句,和Wilcoxon 符號(hào)檢驗(yàn)的函數(shù)是一樣的,只是參數(shù)不太一樣(Is the W statistic output by wilcox.test() in R the same as the U statistic?)。

wilcox.test(var1, var2, paired=TRUE) # signed rank test
wilcox.test(var1 ~ var2, paired=FALSE) # Mann Whitney U test
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • pyspark.sql模塊 模塊上下文 Spark SQL和DataFrames的重要類: pyspark.sql...
    mpro閱讀 9,892評(píng)論 0 13
  • 減肥,是女人一生重大的事業(yè)??珊薜氖?,中國(guó)的男人一點(diǎn)也不像日本、韓國(guó)那樣注重自己的身材,個(gè)個(gè)都有啤酒肚。今晚,在《...
    求無(wú)1824閱讀 393評(píng)論 0 1

友情鏈接更多精彩內(nèi)容