Skip to Content
R 錦囊妙計
book

R 錦囊妙計

by Paul Teetor
January 2014
Beginner to intermediate
488 pages
8h 1m
Chinese
GoTop Information, Inc.
Content preview from R 錦囊妙計
9.17 檢驗相關係數顯著性
|
247
由於樣本資料是成對觀測值,我們必須設定
paired=TRUE
> wilcox.test(fav, unfav, paired=TRUE)
Wilcoxon signed rank test with continuity correction
data: fav and unfav
V = 0, p-value < 2.2e-16
alternative hypothesis: true location shift is not equal to 0
其中,結果顯示
p
值近似於零。從統計學的角度,我們可以拒絕兩種情況任務完成時間
相等的假設。實務上合理的結論是:兩種不同情況的任務完成時間有顯著差異。
此外,在函數中設定
paired=TRUE
是至關重要的。由於觀測值之間不是獨立的,
將配對資料視為非配對資料來處理,會導致錯誤的結果。例如,若於函數中設定
paired=FALSE
,並重新執行程式碼,產生的
p
值變為 0.2298,而導致相反地結論。
延伸資訊
錦囊 9.15 關於參數檢定。
9.17 檢驗相關係數顯著性
問題點
您計算兩個變數之間的相關性,但是您不知道其相關係數是否具有統計顯著性。
解決方案
使用
cor.test
函數,可計算
p
值與相關係數的信賴區間。若變數來自常態分配的母體,
可使用預設相關係數的衡量值,即 Pearson 方法:
> cor.test(x, y)
對於非常態分配母體,則使用 Spearman 方法代替:
> cor.test(x, y, method="spearman") ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

R 语言经典实例(原书第 2 版)

R 语言经典实例(原书第 2 版)

J.D. Long, Paul Teetor
優雅的SciPy|Python科學研究的美學

優雅的SciPy|Python科學研究的美學

Juan Nunez-Iglesias, Stéfan van der Walt, Harriet Dashnow
C++语言导学(原书第2版)

C++语言导学(原书第2版)

本贾尼 斯特劳斯特鲁普

Publisher Resources

ISBN: 9789862769829