0
我應該如何分析四個序數(0,1,2,3)和各種範圍的連續值之間的相關性?散點圖看起來像一個4個平行的水平點。Correaltion和迴歸分析
我應該如何分析四個序數(0,1,2,3)和各種範圍的連續值之間的相關性?散點圖看起來像一個4個平行的水平點。Correaltion和迴歸分析
您可以運行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
請出示示例數據,最好代碼 –
我要上傳數據的情節,但我不能,因爲低信譽的,可我有你的電子郵件? – user27379
你可以顯示原始數據表嗎?這樣別人也可以回答。 –