Measure of goodness of polynomial fit at specific points or weighted analysis?

I have some astrophysics data of "particle density vs orbital position" of a moon that emits a lot of particles. My research deals with the intensity of the scattered light which is scattering angle dependent only, and should not be position dependent. Unfortunately, if there are more particles being ejected, then the intensity is higher, which happens at some places in the orbit.

To get rid of this dependence, I plotted my "particle densities vs position data", and fit it with a high order polynomial in Mathematica using the "Fit" function. I plotted the residuals, and chose a fit that caused no patterns in the residuals.

Now I'm trying to propagate error for error bars on my final "Intensity vs Scattering Angle" plot. I know the error comes from the particle density measurements themselves, the conversion from particle density to intensity, and the fact that my curve was not an exact fit. I found the first two values, but the error of the fit is stumping me. I don't want to use the "residual standard deviation" or other error calculations that give only one number since there are parts of the curve that fit better than others.

Is there a weighted error quantity or anything similar that is applicable here? Most things I find are only applicable for linear fits.

Edit: Here are the plots I'm talking about (Don't worry about the units).[![This is the plot of particle density vs orbital postion with the polynomial fit applied. You can see it fits better along the ends but not as well in the middle.

• Good news! Your polynomial fits are actually multivariate linear (in the space [position, position^2, position^3, ...]), so you can apply the linear theory to these polynomials. Commented Jan 26, 2023 at 17:17
• Ah, good to know! So would you recommend a mean square weighted deviation? Or another measure? Commented Jan 26, 2023 at 17:32
• oh I think I misunderstood where the problem was. "parts of the curve that fit better than others" means you have heteroscedasticity, exactly how it presents itself will define our solution. can you share a plot of the residuals? Commented Jan 26, 2023 at 18:43
• I just edited the post to show my plots. My first plot has a fit that seems to work really well along the edges but not as well in the middle. I posted the residuals also. I would like to solve for an error quantity that is larger in that middle section to account for the looser fit. Commented Jan 27, 2023 at 1:31
• Thank you for adding the plots. In the first one, it seems that the observations come from a mixture of two distributions (with somewhat similar shape) for x > 130. If you are not modeling this structure, then no "one-component" model can fit the mixed data well. Commented Jan 27, 2023 at 18:51