1
$\begingroup$

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

enter image description here And the residual plot is as following:

enter image description here

The distribution of the residuals is show in the following graph:enter image description here

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:

enter image description here

And the distribution plot of the residuals:

enter image description here

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:

enter image description here

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.

$\endgroup$
6
  • 1
    $\begingroup$ Please don't cross-post. The "problem" with your last plot is purely a problem with your code. $\endgroup$
    – Roland
    Mar 9, 2020 at 14:34
  • $\begingroup$ @Roland ok, I see. But what about my other question? $\endgroup$
    – user255658
    Mar 9, 2020 at 14:44
  • $\begingroup$ Define "good" ... The diagnostic plots look good. $\endgroup$
    – Roland
    Mar 9, 2020 at 14:47
  • $\begingroup$ @Roland but is it "legal" to transform both y and x? $\endgroup$
    – user255658
    Mar 9, 2020 at 14:59
  • 1
    $\begingroup$ 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. $\endgroup$
    – Roland
    Mar 9, 2020 at 15:08

1 Answer 1

1
$\begingroup$

Your histograms of residuals do seem "good", and you cannot use them to conclude non-normality. But qqplots of the residuals would serve you better: please show them to us.

As for your first model, there is a clear curvature, and I would maybe try to include a square term in the model.

The residuals vs fitted plot for the transformed model seems to have gotten rid of the curvature, but that itself is only a weak argument for the log transformation.

You should tell us also what your x and y are in the real world.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.