corr
线性或秩相关性
说明
示例
输入参数
名称-值参数
输出参量
详细信息
提示
corr(X,Y)
和 MATLAB® 函数 corrcoef(X,Y)
之间的区别在于 corrcoef(X,Y)
返回两个列向量 X
和 Y
的相关系数的矩阵。如果 X
和 Y
不是列向量,corrcoef(X,Y)
会将它们转换为列向量。
算法
当您指定 Weights
名称-值参量时,corr
通过对方差和协方差计算进行加权来计算皮尔逊相关性。对于斯皮尔曼相关性(基于秩),corr
按照 [5] 的建议计算加权秩。要计算肯德尔相关性(基于排列计数),corr
会扩展 [6] 中的加权计数算法以考虑结值。
参考
[1] Gibbons, J.D. Nonparametric Statistical Inference. 2nd ed. M. Dekker, 1985.
[2] Hollander, M., and D.A. Wolfe. Nonparametric Statistical Methods. Wiley, 1973.
[3] Kendall, M.G. Rank Correlation Methods. Griffin, 1970.
[4] Best, D.J., and D.E. Roberts. "Algorithm AS 89: The Upper Tail Probabilities of Spearman's rho." Applied Statistics, 24:377-379.
[5] Bailey, Paul, and Ahmad Emad (2023). wCorr: Weighted Correlations. R package version 1.9.7, https://american-institutes-for-research.github.io/wCorr.
[6] Van Doorn, Johnny, et al. "Using the Weighted Kendall Distance to Analyze Rank Data in Psychology." The Quantitative Methods for Psychology, vol. 17, no. 2, June 2021, pp. 154–65.
扩展功能
版本历史记录
在 R2006a 之前推出另请参阅
corrcoef
| partialcorr
| corrcov
| tiedrank