Take errors into account for a data fit

In summary, your data contains errors that are almost identical for each data point, so a weighted fit in terms of the errors would not change the results significantly. You could try to take the errors into account by fitting three separate models, for the upper and lower points of the error bars, but you aren't sure that would give you the information you need.
  • #1
kelly0303
561
33
Hello! I have some data in which the dependent variable ##y## has, for each data point, an error bar associated with it ##\delta y##. The errors are almost identical for each datapoint, so doing a weighted fit in terms of the errors would not change the results significantly. How can I take the errors into account properly, such that the error bars are reflected in the error on the parameters of the fit? I though initially to have 3 fits for the actual data points, for the upper and for the lower points of the error bars, but I am not sure that would give me what I need, as the function is highly nonlinear and this kind of fit would just influence the overall amplitude, not the other (more important) parameters. Thank you!

<Mentor - moved to statistics forum >
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Could please you define what you mean by 'the errors are almost identical'? Which makes me wonder about your view of the effect on amplitude of your proposed treatment. It would help our statisticians if you elaborated on your dataset as well.

Thanks.
 
  • #3
jim mcnamara said:
Could please you define what you mean by 'the errors are almost identical'? Which makes me wonder about your view of the effect on amplitude of your proposed treatment. It would help our statisticians if you elaborated on your dataset as well.

Thanks.
Thank you for your reply! The measurements are some counts produced in an experiment at different energies. The counts are, for each energy, somewhere between 100,000 (for background) and 300,000 (for signals). The error is Poisson i.e. square root of the number of counts.
 
  • #4
Listed roughly in order of difficulty of estimating errors, I have fit count data using linear least squares (sometimes with a square root transformation), Poisson regression, and non-linear least squares to physical models.

From what you wrote I'm assuming you are asking about the last case and you have a physical model that is nonlinear in its parameters.

What software are you using to perform the fit? Because a short answer is that many packages (R, Matlab, Python) are capable of reporting errors for the model predictions and model parameters. The values required to estimate these errors are often calculated as part of the same iterative process as the fit.

If you are writing your own code to do it, you may be able to make use of an asymptotic approximation using the Hessian matrix (second derivatives) of a log likelihood. Briefly, a fit routine typically estimates both the parameters and the variance-covariance matrix related to the Hessian from which, along with the independent variable data, error estimates may be obtained.

See this article I found after a quick search: nonlinear least squares. Especially pages 5-10.

If you aren't reinventing the wheel for educational purposes, Python has the lmfit package that I'd probably use if I were doing it. R has an equivalent package called nls(?) I think, but I haven't used it.
 

1. What does it mean to "take errors into account" for a data fit?

When performing a data fit, it is important to consider the potential errors or uncertainties associated with the data points. This means incorporating the error values, either provided by the data source or estimated by the researcher, into the fitting process. This allows for a more accurate and comprehensive analysis of the data.

2. How do you incorporate errors into a data fit?

There are various methods for incorporating errors into a data fit, depending on the type of data and the fitting technique being used. One common approach is to use a weighted least squares method, where the error values are used to assign weights to each data point. Another method is to use a Monte Carlo simulation, which involves running multiple fits using different error values to determine the range of possible outcomes.

3. Why is it important to take errors into account for a data fit?

Ignoring errors in a data fit can lead to inaccurate results and conclusions. By taking errors into account, the fit will better represent the true relationship between the variables being studied. This is especially important when dealing with experimental data, where errors can arise from various sources such as measurement limitations or human error.

4. Can errors affect the outcome of a data fit?

Yes, errors can have a significant impact on the outcome of a data fit. If errors are not properly accounted for, the fit may not accurately represent the data and could lead to incorrect conclusions. In some cases, the presence of errors can also affect the statistical significance of the fit and the validity of any conclusions drawn from it.

5. How can you determine the appropriate error values to use for a data fit?

The appropriate error values to use for a data fit will depend on the specific data being analyzed and the fitting method being used. In some cases, the error values may be provided by the data source or can be estimated based on the experimental setup. In other cases, it may be necessary to conduct a sensitivity analysis to determine the impact of different error values on the fit results. Consulting with other experts or conducting further research on the topic can also help determine appropriate error values.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
912
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
8
Views
896
  • Set Theory, Logic, Probability, Statistics
Replies
28
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
26
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
13
Views
1K
Back
Top