繁体   English   中英

Spearman的正r值和负斜率

[英]Positive Spearman's r value with negative abline

我正在查看本周末收集的一些数据,其中一项Spearman相关性检验给了我一个正值,但是当我在绘图上添加一个下斜线时,它正在下降。 我很好奇这怎么可能。

以下是研究数据:

    Year Matches Total
1   1958    2   7
2   1959    2   14
3   1960    5   9
4   1961    2   20
5   1962    4   27
6   1963    5   20
7   1964    5   25
8   1965    5   20
9   1966    3   18
10  1967    5   28
11  1968    6   26
12  1969    4   24
13  1970    6   22
14  1971    7   32

这是我使用的过程:

Results<- (Study$Matches/Study$Total)*100
Year<-Study$Year
plot(Year, Results, main = "MAIN")
fit1 <- lm (Results ~ Year, data = Study)
abline(fit1, lty = "dashed")
cor.test(Year, Results, method = "s")

拟合产生线性模型。 皮尔森是线性相关,它是负数。 Spearman是非线性的并且基于排名。

> cor.test(Year,Results,method="spearman")

Spearman's rank correlation rho

data:  Year and Results
S = 438.9647, p-value = 0.9048
alternative hypothesis: true rho is not equal to 0
sample estimates:
       rho 
0.03524238 

Warning message:
In cor.test.default(Year, Results, method = "spearman") :
  Cannot compute exact p-value with ties
> cor(Year,Results,method="spearman")
[1] 0.03524238
> cor(Year,Results,method="pearson")
[1] -0.17501

它正确绘制了负线性相关性。 恰恰是Spearman是积极的。 当相关性较低时,可能会发生不直观的事情。 高p值也是一个提示。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM