In linear regression, x is weight and y is price; none of the x and y can be negative. The linear regression line with b_0=-57.9 shows a negative y for x<=10 approximately. This signifies that more the slope gets steep with a suitably high deviation of x from the origin, more this situation is probable. How do you explain this?

Linear regression

  • $\begingroup$ Try manually implementing MLE using constrained optimization. In your constraints, specify that b_0 >0. docs.scipy.org/doc/scipy/tutorial/… $\endgroup$
    – Anjan
    Commented Nov 30, 2023 at 20:31

1 Answer 1


The linear model fitted your data this way because it led to the lowest error between the line and your data. It didn't take into account that you must be positive because you didn't include that knowledge in the formula of your model.

The simplest solution for that problem would be to estimate the model without b_0, just y = b_1 * x. However, as we see it wouldn't describe your data well. You could try adding b_2 * x^2 to your formula, but I don't see it in the data either. In my view, it appears that there is a break-point nearby x=35. I would fit two lines with refraction in x=35. The simplest way for you could be estimating y = b_1 * x for x<35 first and then the second part for x>=35 with sticking to the common point in x=35.

How I see the relation in your data:

How I see you should fit your line

  • $\begingroup$ I appreciate your idea of solution. This is an example situation I provided for clarification of the negative b_0, that whether negative b_0 is permissible. In this video youtube.com/watch?v=WkVvZreJtmU&t=132s, the teacher says that the y-intercept is meaningless in many real world situations. In that case, the line can be anywhere along the y-axis. If so, then how it will predict y for an x? $\endgroup$
    – PS Nayak
    Commented Dec 1, 2023 at 4:48
  • 1
    $\begingroup$ So, it depends. I wouldn't say that the y-intercept is meaningless (without it you couldn't fit your data well), but in some problems in some domains, like economics, its interpretation is meaningless. There are many situations when you are interested in the interpretation of the coefficient to conclude that "when x increases by 1, y increases by b_1 ceteris paribus" and then b_0 is meaningless in that term, but still must be present in the model to allow other variables fit well. $\endgroup$ Commented Dec 1, 2023 at 7:01
  • $\begingroup$ This is the explanation I was looking for. $\endgroup$
    – PS Nayak
    Commented Dec 1, 2023 at 8:17

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.