0

我应该如何分析四个序数(0,1,2,3)与连续值的各种范围之间的相关性?散点图看起来像一个 4 个平行的水平点。

4

1 回答 1

0

您可以运行 Spearman 等级相关性检验。使用 R,

require(pspearman)
x <- c(rep("a", 5), rep("b", 5), rep("c", 5), rep("d", 5))
x <- factor(x, levels=c("a", "b", "c", "d"), ordered=T)
y <- 1:20

spearman.test(x, y)

    Spearman's rank correlation rho

data:  x and y
S = 40.6203, p-value = 6.566e-06
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.9694584 

Warning message:
In spearman.test(x, y) : Cannot compute exact p-values with ties

非显着相关

set.seed(123)
y2 <- rnorm(20)
spearman.test(x, y2)

Spearman's rank correlation rho

data:  x and y2
S = 1144.329, p-value = 0.5558
alternative hypothesis: true rho is not equal to 0
sample estimates:
     rho 
0.139602 

Warning message:
In spearman.test(x, y2) : Cannot compute exact p-values with ties
于 2014-02-20T18:18:36.453 回答