Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
正面斯皮尔曼';带负abline的sr值_R - Fatal编程技术网

正面斯皮尔曼';带负abline的sr值

正面斯皮尔曼';带负abline的sr值,r,R,我正在查看本周末收集的一些数据,其中一个斯皮尔曼相关测试给了我一个正值,但当我在图上添加一条直线时,它正在下降。我很好奇这怎么可能 以下是研究数据: 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

我正在查看本周末收集的一些数据,其中一个斯皮尔曼相关测试给了我一个正值,但当我在图上添加一条直线时,它正在下降。我很好奇这怎么可能

以下是研究数据:

    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")

结果拟合产生线性模型。Pearson为线性相关,为负相关。斯皮尔曼是非线性的,基于排名

> 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

它正确地绘制了负线性相关性。碰巧斯皮尔曼是积极的。当相关性较低时,可能会发生不直观的事情。高p值也是一个线索。

是的。OP应查看
plot(排名(结果)~年份,数据=研究)的结果;abline(lm(等级(结果)~年,数据=研究))