如何解决R线性回归图问题?

我对以下图形有疑问:

如何解决R线性回归图问题?

对于我在plot()中输入的每个值,都会得到此图。有人知道这意味着什么吗?

Cor.test正常运行,我的相关性很弱。

我的代码:

cor.test(podatki$v54,podatki$v197,method = c("pearson"),conf.level = 0.95,use = "all.obs" )


plot(podatki$v54,podatki$v197)
pluto416500089 回答:如何解决R线性回归图问题?

您的图形看起来是这样,因为这些点直接绘制在彼此的顶部。

您可以使用jitter(...)函数向数据点添加少量随机性,这样它们就不会直接位于彼此之间(它使它们四处晃动,因此您可以看到下面的那些!)您可以复制并粘贴以下示例:

# create some random numbers to plot. all are values 1-5.    
x1 <- sample(c(1:5),100,replace = TRUE)
x2 <- sample(c(1:5),replace = TRUE)

# plotting without jitter
plot(x1,x2)

enter image description here

# plotting with jitter 

plot(jitter(x1),jitter(x2))

enter image description here

jitter(...)会少量更改值,因此仅将抖动的数据用于绘图,否则会影响您的结果!

本文链接:https://www.f2er.com/3163173.html

大家都在问