 # plotting linear regression with index as dependent variable

Hi,
I want to do a linear Regression. Therefore I built an index of some Likert-scaled variables to make them quasi-metric. Cronbach's Alpha is 0.73. This index should be my dependent variable. But I have no idea how to plot with an index as dependant variable and an ordinal independant variable. My plot looks like the following:

``````> summary(lm(data = dat, Index_individueller.Beitrag ~ Alter.Wahlrecht))

Call:
lm(formula = Index_individueller.Beitrag ~ Alter.Wahlrecht, data = dat)

Residuals:
Min       1Q   Median       3Q      Max
-15.0773  -2.2372  -0.1372   2.8828  10.8028

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)      17.2772     0.3860   44.76  < 2e-16 ***
Alter.Wahlrecht   0.9600     0.1343    7.15 2.12e-12 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 4.592 on 728 degrees of freedom
Multiple R-squared:  0.06561,	Adjusted R-squared:  0.06433
F-statistic: 51.12 on 1 and 728 DF,  p-value: 2.119e-12

> plot(data = dat, Index_individueller.Beitrag ~ Alter.Wahlrecht)
> abline(lm(Index_individueller.Beitrag ~ Alter.Wahlrecht))
``````

The plot does not look like there is a linear correlation, but the regression is significant. Is the regression wrong or the way I plot it?

Thanks for any help! I'm really new with R

I don't think that theres anything necessarily wrong with any of it, only that displaying all the points in the way you do, its not-trivial for the brain to judge the density / the center . to see that they are rising crudely linearly. you could try with a boxplot or violin plot maybe.
If you share your data, forum users might experiment and share their code back to you.
To share your data, you can use datapasta package, or base function dput() on your `dat`

Thanks a lot! It works with violin plot and also looks nice.

Unfortunately, the sharing of my data does not work, but I will work to get more familiar with R, so I can do this for my next question!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.