# Transformation of residual plot of linear regression model

I have a linear model which is represented by the following plot, with a fitted line:

And the residual plot is as following:

The distribution of the residuals is show in the following graph:

I see that there is a pattern in the residual plot, and also that the residuals are not normally distributed. So from the model given by :

$$y=ax$$ for some $$a \in \Bbb R$$

I transform it into the following model:

$$log_2(y)=a.log(x)$$

So then here is my residual plot:

And the distribution plot of the residuals:

Well, now my residual plot and the residuals' distribution looks better, since in the residual plot there is no pattern and the distribution is now improved.

But here is the plot with the new fitted line of the transformed linear model:

Questions:

$$1)$$Is the transformation which I made a good transformation?

$$2)$$Do I have to "care" about the new fitted line? I'm not sure what to do with the fact that it's not alligned with the points like before.

• Please don't cross-post. The "problem" with your last plot is purely a problem with your code. Mar 9 '20 at 14:34
• @Roland ok, I see. But what about my other question?
– user255658
Mar 9 '20 at 14:44
• Define "good" ... The diagnostic plots look good. Mar 9 '20 at 14:47
• @Roland but is it "legal" to transform both y and x?
– user255658
Mar 9 '20 at 14:59
• Well, you need to be aware that you have now a non-linear model on the original scales and are making an assumption about the uncertainties, but of course that can be entirely appropriate or even desired. Mar 9 '20 at 15:08