# Better way to fit/model data with high & low density areas (and with a geometric fit?)

I've got some data with a very high density of data points in one area, and I'm trying to produce an effective fit.

I'm being quite crude (stuck doing it this way for now) by "binning" the data in our dependent variable and performing a fit on each set of data in order to compare the impact. For example, here's three separate bins for comparison:

I'm expecting to see a larger difference in the curves at the top end of this, and it looks visually like there's data points that should be shifting the green curve away from the red & blue one - which is what I'm expecting.

I'm uncomfortable having to use 4th order polynomials to try get a sensible fit, I'm having trouble finding a curve that can fit the very high density data in the middle/left and the lower density (but very important) right.

I began to wonder whether using the y axis (quick Wikipedia came up with "ordinary least squares") to judge fit quality might be an issue. It's judging performance based on the red lines, rather than what might make more sense in the orange lines:

Wikipedia tells me this is a geometric fit, however, when researching this I'm getting many multivariate PCA type analysis, and maybe performing geometric fits for linear data.

I can't seem to find any resources on polynomial geometric fitting though - is it possible/good practice?

I'm sure there's a better way of going about this, can anyone point me in the right direction? My high school level knowledge of statistics is showing...

• 1) “Wikipedia tells me this is a geometric fit, however” can you add the link to Wikipedia and explain how Google found this. 2) Is your question how to perform geometric fitting? Or what to do with the different areas? 3) The purpose of your analysis is only to test the hypothesis about the green data being shifted to the right or above? 4) what sources of error/variability do you encounter in your data? What do the axes mean in your graph? You seem to have horizontal distributed clusters, is there a lot variability in the horizontal variable? Sep 22, 2023 at 5:15