# Is my regression model and plot wrong? Using R studio

The picture is a residual plot, standardised residuals on the ylab and predicted income on the xlab. However as you can see, the xlab are so small that this can't possibly be correct. I have used many different commands, however, I can't seem to figure this out. I use rStudio and this is the commands I Use:

plot(fitted(mod31), stdres(mod31),
xlab='Predikert inntekt',
ylab='Standardiserte residualer',
cex=0.5,
cex.lab=1.1,
cex.axis=1.1)
abline(0,0, col ='blue')


Can anyone please let me know where I am wrong?

This is my reg.model

mod31 = lm(income~workinghrs+woman+age+age.2+leader+educ, data=d)
summary(mod31)


Also when I log my variables, the independent variable and the dependent variable, I get very small values as well.

I use these commands

d$income.l = log(d$income)
d$workinghrs.l = log(d$workinghrs)

mod31.l = lm(income.l~workinghrs.l+woman+age+age.2+leader+educ, data=d)
summary(mod31.l)


Working hours is the research variable, while the rest are control variables.

Can someone help me?  • This isn't really about R, it's about reading the graph. So I vote to leave it open. – Peter Flom Oct 13 '17 at 23:47
• Siisqo, in order that you (or we) can improve (clarify) your question (to help future visitors of this website), could you explain what you mean by 'very small values'? – Martijn Weterings Oct 19 '17 at 8:43

## 2 Answers

The x values are not small at all. They are using exponential notation. 2e+05 = 200,000. The x-axis ranges from 0 to 600,000. You don't say what currency you are using, but that's certainly a lot of euros or dollars.

Assuming that you refer to the values near zero, or even negative, as being 'so small'.

This is "correct", or at least correct in the framework of the model that you designed. The model returns low and negative values due to two effects.

1. First of all, the model allows negative values.

If you don't like this then you can use different relationship for the mean, and possibly also for the errors. (for example a Pareto distribution or exponential model might fit these data)

2. Your observations are not properly fitted by your linear relationship.

This is most clear if you observe the residuals. At the lower end the predicted value underestimates (systematically positive residuals) the observed values (and this underestimation pushes the result to low values or even negative, not coincidently, if you would add up the error on y to your predicted on x, then the values are not so low anymore).

The discrepancy from linearity might possibly be tiny. It can be caused by the many points that you have at the high values. If for those high values the angle of the line is only slightly different then they may dominate the angle of the line, such that the few observations at the low end become underestimated.

(basically, the points at the low end do not really matter, and you are extrapolating the results that are mainly determined by points at high values. And you find out that this extrapolation makes an error, gives low values)

There are many ways to treat these problems, and I already hinted in the discussion above. But if I would make a guess for a first step that you can take to improve the analysis then it would be to fix the model to better relate to the error distribution.

What I roughly see is a cloud of points trough which a line with slightly negative angle would not fit so badly... if only you did not have those outliers on the high end. (and there seems also to be a slight curve)

The error/residual terms seem to have two properties (making them not Gaussian and equal variance). 1) The distribution of the residuals is not symmetric. You see several extreme values on the high end. 2) The dispersion of the residuals is not continuous. The point are very narrow at the low end (the point are so narrow that by hand I could draw a better line than your model does) and very wide at the high end.

Other options possibilities that I see at first glance:

1. Transform the dependent variable to a log scale (as you already did). This would solve the problem that you can not get negative income, that the function is not linear, that the dispersion is not constant, and that the dispersion is not symmetric. You can also try other transformations.
2. Use cross terms (very important see the following explanation). Possibly the slope of the linear relationship with arbeidstid is different for different classes. (currently the different groups act only as an intercept, but I can imagine that the increase of salary as function of worktime is not the same for say, a server in a burger place, a data scientist, and a ceo of a bank). Simply said, your current model gives everybody the same hourly salary. You have sufficient degrees of freedom to add additional terms.
3. Use a quasi-likelihood model. And define proper link functions. Or use a different transformation than the log transform that you currently tried.
4. Use a robust model. In case you can't manage to distribute the variation in the residual terms and apply proper weights to the values at different income levels.
5. ...
6. ...

I imagine that if you get a sufficient model (solve the second point, that your linear relationship is bad), then you may possibly worry less about the values going negative (depending on how much you want every single value to be correct and use difficult stuff for this, or just get a simple and quick impression).