I get sets of points that are generally linear with slight curvature to them. We've been fitting quadratic curves to them which works fine if we have decent points across the range but if there are missing parts/outliers then the curve will fit well in that range but then veer off sharply.

Basically a very gradual curve that I'm only seeing/fitting sections of at a time.

I want to fit a "slightly" quadratic curve. I guess either hard constraints on the ax^2 term or maybe a penalty to keep a small as possible while fitting well. This way even if the fit isn't perfect the error is small.

Any advice on how to accomplish this would be appreciated.

EDIT: More information. This in image processing, the points are extracted from an image and I'm trying to fit a curve to them. If my extraction phase does a bad job and I only have, for example, noisy points on only 1/3 of the image then the fitted curve often will swing wildly and not fit well to the portions I have zero points in. The true model is a very gradual curve, that is, mostly linear with a slight possible bend. I'm trying to fit knowing that model. You can easily fit a parabola but that's an impossible real life answer. Trying to constrain that.

  • $\begingroup$ It should be fairly simple to code up a linear model which only penalizes the quadratic term. Have you tried that? $\endgroup$ Nov 9, 2021 at 20:26
  • 1
    $\begingroup$ "... I'm only seeing/fitting sections of at a time" suggests you want to fit a spline to your data. Some more guidance from you concerning what you actually need to accomplish would be helpful. $\endgroup$
    – whuber
    Nov 9, 2021 at 21:11
  • $\begingroup$ @whuber These are aerial images so the object in question spans multiple images but I'm working on an image at a time hence the "sections at a time". $\endgroup$
    – user27108
    Nov 10, 2021 at 12:19

1 Answer 1


If you apply constraints then you still get that outliers will have influence on the fitting. E.g. the fitted coefficients will be stuck at the edge of the constraints whenever you have those outliers. It is a bit simplistic way to deal with the outliers.

Using a robust fitting method, e.g. trimmed least squares you will be able to eliminate the effect of the outliers completely.

There are many other ways. What you need to consider in the choice of robust fitting method is the type of influence that you want the outliers to have. Are they part of the population that you wish to model, and should they be incorporated somehow, or do you want to eliminate them? What is your quadratic curve supposed to represent and how does it relate to the outliers?


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.