I have two variables which are measured on a Likert scale. I ran the Spearman correlation test to test the relationship between them and they have a negative correlation coefficient (-0.729 with a p-value < 1.2e-12). I am pretty new to plotting with R and my question is, is there any way I can plot the relationship between the two variables? I am having difficulties with what kind of plot can depict the relationship since they are discrete.
1 Answer
One idea is to do a jittered scatterplot.
I simulated 100 Likert scores x
from 1 to 7, and
roughly positively associated Likert scores y
.
They are summarized and tabulated below.
summary(x)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.00 3.00 5.00 4.48 6.00 7.00
table(x)
x
1 2 3 4 5 6 7
5 8 13 22 24 16 12
summary(y)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.00 3.00 4.00 3.94 5.00 7.00
table(y)
y
1 2 3 4 5 6 7
9 11 19 23 19 14 5
cor(x, y, meth="s")
[1] 0.9044931
A standard scatterplot shows locations of the 100 $(x,y)$ pairs, but there is a lot of over-plotting and we can't get an idea how many individuals are represented by each point.
plot(x, y)
By jittering (adding a small amount of random noise to) each score, I can see how many individuals correspond to each location.
xj = x + runif(100, -.2,.2)
yj = y + runif(100, -.2,.2)
plot(xj, yj, pch=20)
abline(v=1:7, col="green2")
abline(h=1:7, col="green2")
Here I have jittered by $\pm 0.2$ or less.
One can choose the amount of jittering---depending
on the sample size and the strength of the association---to
seek the best graphical effect. If you have a very large
sample size, then you may want to use small dots for
individual subjects, by using parameter pch-"."
in plot
,