我有一个带有非参数数据的数据集,我在这里寻找两个观测值之间的相关性。当我运行spearmans相关性测试时,我在R中得到以下答案:
Spearman's rank correlation rho
data: g120 and landscape1000
S = 990.93, p-value = 0.5936
alternative hypothesis: true rho is not equal to 0
sample estimates:
rho
0.1307591
正如你可以看到的那样rho是正面的,但我从我的脚本得到的输出不是:
绘制图形的代码是:
# 1km - Gradering 1, 20m Scatter plot and correlation with spearman test
plot(landscape1000~g120, xlab="Inventory 1, 20m",ylab="Landscape1000m",pch=20)
model.g120.1km=lm(landscape1000~g120,data=raps)
abline(model.g120.1km)
cor.test(g120,landscape1000,method="spearman")
有没有人知道为什么会这样?