My linear model is showing a clear trend in the errors (red line is what it should be). So my high samples are being underestimated and my low samples are being overestimated. There's a clear linear relationship in the errors.

enter image description here

How can I properly create a function that calibrates each prediction so that it better matches the desired red line? Like so:

enter image description here

  • 4
    $\begingroup$ Include an additive constant term in the model rather than forcing the line to pass through zero. $\endgroup$
    – whuber
    Commented Oct 3, 2016 at 22:39

1 Answer 1


@whuber is correct. I will just expand his answer and give you one demo for details. I will use mtcars data in R. We are using a car's weight to predict the mile per gallon variable.

What you are doing (note, the -1 in formula means do not add intercept to the model):


The way to fix (default settings in R is adding intercept):




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.