scipy.stats.mstats.

kendalltau#

scipy.stats.mstats.kendalltau(x, y, use_ties=True, use_missing=False, method='auto', alternative='two-sided')[原始碼]#

計算兩個變數 xy 的 Kendall 等級相關 tau 值。

參數:
x序列

第一個資料列表 (例如,時間)。

y序列

第二個資料列表。

use_ties{True, False}, 選項性

是否應執行 ties 校正。

use_missing{False, True}, 選項性

是否應將遺失資料分配等級 0 (False) 或平均等級 (True)

method{‘auto’, ‘asymptotic’, ‘exact’}, 選項性

定義用於計算 p 值的[1]方法。「asymptotic」使用適用於大樣本的常態近似值。「exact」計算精確的 p 值,但僅在不存在 ties 時才可使用。隨著樣本大小增加,「exact」計算時間可能會增長,且結果可能會失去一些精確度。「auto」是預設值,並根據速度和準確性之間的權衡選擇適當的方法。

alternative{‘two-sided’, ‘less’, ‘greater’}, 選項性

定義對立假設。預設值為 ‘two-sided’。以下選項可用

  • ‘two-sided’:等級相關性為非零

  • ‘less’:等級相關性為負數 (小於零)

  • ‘greater’:等級相關性為正數 (大於零)

返回:
resSignificanceResult

包含屬性的物件

statisticfloat

tau 統計量。

pvaluefloat

假設檢定的 p 值,其虛無假設為無關聯,tau = 0。

參考文獻

[1]

Maurice G. Kendall, “Rank Correlation Methods” (第 4 版), Charles Griffin & Co., 1970.