# How to find the uncertainty in the peak of a graph?

I have an experiment in which we measure dielectric constant(e) vs the temperature and the peak is supposed to be the curie temperature. I measured e for many different values of T. I want to find the error in the peak temperature Tc. An answer on this site for a different question says that if I know the curve it's supposed to be, I can fit it to it, but I don't know the curve. Also, I did the experiment only one time so I don't have many datapoints of Tc. I just need a method. Is there a function available in some python library such as scipy to directly find the peak and it's error? I don't know much statistics other than rudimentary gaussian distribution and it's application in error analysis and I started using python today and plotted some simple graphs and did one simple linear regression. Help would be much appreciated.

• The answer to the different question provides the best approach I think. This is a statistical problem called (Non-Linear) Curve Fitting. The simplest case is fitting a straight line $y=ax+b$ to find the parameters slope $a$ and intercept $b$. Advanced data-fitting software will allow you to select different forms of curve and give you an estimate of the error in each parameter. If you don't know the theoretical form of the curve try a polynomial with the fewest possible parameters - eg a parabola $y=a(x-b)^2+c$. For best results use only points close to the peak. Commented Sep 16, 2022 at 14:04
• If the graph is a sharp lambda shape then it might be better to split the data set in two, possibly with some overlap close to the transition point - ie some data points are assigned to both sets. Each side can be fitted separately with a different function - eg $y=a/(x-b)^c+d$ on one side, $y=e/(x-f)^g+h$ on the other. Ideally $b, f$ should be the same. If not take the average and use the larger error value of the two. Commented Sep 16, 2022 at 18:29
• Thank you, but it sounds complex, is there a way to just estimate the error in such cases? I don't necessarily need a confidence interval kind of error : so suppose my two data points closest to the peak were 5 degrees to the left and right, then is it ok if I say the error is 5 degrees? Commented Sep 17, 2022 at 7:30
• Yes. That kind of rough estimate of the peak position and error is usually acceptable. But your teacher might expect you to use regression analysis. Commented Sep 17, 2022 at 9:11

This problem is a good candidate for bootstrapping, a numerical, nonparametric approach that can be used to estimate uncertainty without requiring committal to a certain overall model.

The principle of bootstrapping is that lacking additional data, the best estimate of this additional data is the current data.

So you've used your entire data set to estimate the peak position, but now you'd like to know the uncertainty in the peak position. This is done by resampling with replacement. (The ability to gain more information from a data set that seems to have already been used entirely is the source of the name "bootstrap.")

That is, if your original data set looked like [$$x_1$$ $$x_2$$ $$x_3$$ $$x_4$$ $$x_5$$], resampling with replacement might give [$$x_2$$ $$x_2$$ $$x_2$$ $$x_3$$ $$x_5$$]. Same data set length, but some points may be repeated and others omitted.

Fit a new peak position to this resampled set.

Now repeat, say, 10,000 times, or under the standard deviation of all the peak locations have suitably converged.

This standard deviation provides an estimate of the standard error of the original peak location.

I really like this approach. I've used it for uncertainty estimation and hypothesis testing as described in these slides, with accompanying references.

• Thanks for the answer. I don't understand it as of now, as I don't know much probability distribution and error analysis, but I will get back to you, in say an year haha. Commented Feb 10 at 17:54

One way that always works: Do not hide behind formula and math, but be a real physicist: Look at your data. Look at your experiment. Get an appreciation of what kind of values would be consistent with your setup and your data. Take some fraction of that value range, like, half of it. That is a good approximation of your uncertainty. Since in this way you will have to consider not only the statistical uncertainty (that you would get from some fitting to your data), but also the systematic uncertainty (which one can only guesstimate by understanding the intricacies of an experiment), you error bar will even be more meaningful than any fit to your data. Finally, in your report, write up how you came to identify that error bar.

• Thanks for the answer, and sorry for the late reply. I don't understand it as of now, but I will get back to you, in say an year. Commented Feb 10 at 17:55