3
$\begingroup$

I'm working on a prototype that reads a fixed mass in a loadcell through an 24 bit ADC using a MCU; the device undergoes high temperature amplitudes, therefore the mass readings drift (because of the analog electronics) even though the mass doesn't physically change (it's always 1260 g). I`ve tested the device in a chamber that undergoes cyclic temperature changes. When I did linear regression on the dataset of the test (mass (in grams) vs temperature (in Celsius)), I got a high R^2 but the residual plot looks really weird...

What's the meaning of this? Is it a consequence of the quantization error of the ADC?enter image description here

the Y axis is the mass residue in grams; the X axis is the (temperature*10) in Celsius, e.g. x=100 <=> 10°C

UPDATE: I've added transparency to the plot, it can be verified that most the parallel left-most line has more opacity (because most of the temperature cycles happened at that temperature, hence more observations). Also, by plotting the histogram we can verify that indeed there are 6 distinctive larger groups plus a small group (the opaque blue plot has 6 lines and one small dot near the -12 g label, therefore 7 groups I suppose)

Residuals plot with transparency

Histogram

$\endgroup$
4
  • 2
    $\begingroup$ Do you have six different masses? $\endgroup$
    – mdewey
    Oct 5, 2023 at 17:16
  • $\begingroup$ @mdewey No, but I could find some other masses to test $\endgroup$ Oct 5, 2023 at 17:18
  • $\begingroup$ @mdewey, Do you mean, if I used 6 different masses on the test or if I have 6 masses at my disposal to test? I only used a single mass on the test, the readings change because the temperature affects the analog electronics. $\endgroup$ Oct 5, 2023 at 17:20
  • $\begingroup$ This is duplicate, a question that has been posted many times. e.g. see here: stats.stackexchange.com/questions/235449/… ... naturally that's also a duplicate, but I picked that one because it's particularly clear that it's the same problem there. If you search for descriptions like regression diagonal lines residual and similar variations, you turn up relevant hits. $\endgroup$
    – Glen_b
    Oct 5, 2023 at 22:41

1 Answer 1

2
$\begingroup$

The definition

residual $=$ observed response $-$ fitted response

means that in a plot of residual (y axis) versus fitted (x axis) points for each distinct observed response plot on a line with intercept that value and gradient $-1$. Hence the various distinct observed values plot as a series of parallel lines. That is visible on your plot.

As @mdewey comments, it appears that you have just 6 distinct observed values, which should be easy to check directly.

Some people say unique, not distinct. Similarly some people say predicted, not fitted

$\endgroup$
3
  • $\begingroup$ Thanks for the interpretation, I've decided to add transparency to the residuals plot. I could verify that the left-most parallel line had greater opacity than the other lines, i.e. most of the temperature cycles concentrated around -4°C to +2°C. Then I plotted the histogram, breaking the binning into 10g intervals starting from 1200 to 1290, only 6 big groups of masses could be observed. $\endgroup$ Oct 5, 2023 at 18:24
  • $\begingroup$ But does this great clustering around only 6 groups means my model is broken? (i.e. non-linear) $\endgroup$ Oct 5, 2023 at 18:26
  • 1
    $\begingroup$ I wouldn't say that this alone breaks your model. In principle it's always true that a residual vs fitted plot is a series of parallel lines, but that's not a source of worry if there are many of it. $\endgroup$
    – Nick Cox
    Oct 6, 2023 at 11:49

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.