Quadratic regression with upside-down parabola only

215 Views Asked by At

Currently I'm fitting 2D points with a degree-2 polynomial, using least squares:

$$ b = (X^T X)^{-1} X^T y $$

Example result:

enter image description here

My problem is that I would need all parabolas to have a maximum. Meaning: if the resulting polynomial is:

$$ a x^2 + b x + c $$

then a < 0.

Any hints for solving this?

1

There are 1 best solutions below

2
On

If you are doing a unconstrained least-squares fit, you don't have much control. In your case, it looks like your data is concentrated in a relatively small region, and it looks like it tends to be increasing.

Why does the fit need to have a < 0?

It would help if your plot was zoomed in so the bulk of the data filled the image.