How do I perform a weighted least squares fit with error bars?

Click For Summary

Discussion Overview

The discussion revolves around performing a weighted least-squares fit to a specific data set described by the equation y=a\exp(-b\ln^2(c/x)). Participants explore the necessary transformations and considerations for fitting the model, including handling error bars in the context of weighting the data.

Discussion Character

  • Exploratory, Technical explanation, Debate/contested

Main Points Raised

  • One participant seeks advice on fitting a model defined by the equation y=a\exp(-b\ln^2(c/x)).
  • Another participant questions the notation used in the equation, specifically regarding the interpretation of ln(c/x)².
  • A participant clarifies the notation issue, confirming the intended meaning of the expression.
  • One participant suggests that the problem can be solved by linear regression after some transformations.
  • A follow-up response notes that the absence of the 'b' parameter in the initial transformation does not significantly alter the approach, as it transitions from simple to multivariate linear regression.
  • A participant expresses success in using the transformation for fitting in MatLab but raises a question about whether error bars also need to be transformed for weighting the data.
  • Another participant confirms that the error ranges on the original data points can be used to compute the error ranges on the transformed variables.

Areas of Agreement / Disagreement

Participants generally agree on the need for transformations in the fitting process, but there is some uncertainty regarding the treatment of error bars in the context of weighting the data.

Contextual Notes

Some assumptions about the nature of the error bars and their relationship to the transformations applied to the data may not be fully articulated, leaving room for further exploration.

pergradus
Messages
137
Reaction score
1
Hi, I am trying to do a best least-squares fit to a set of data which is described by the following equation:

y=a\exp(-b\ln^2(c/x))

Where a,b,c are constant parameters I am trying to find values for.

Any advice on how to proceed?
 
Last edited:
Physics news on Phys.org
You write ln(c/x)²
does it mean
(ln(c/x))² = (ln(x/c))²
or
ln((c/x)²) = -2 ln(x/c)
?
 
JJacquelin said:
You write ln(c/x)²
does it mean
(ln(c/x))² = (ln(x/c))²
or
ln((c/x)²) = -2 ln(x/c)
?

The former, I fixed it, sorry for the bad notation.
 
You are lucky. After some transformations, it can be solved by linear regression (in attachment)
 

Attachments

  • Regression.JPG
    Regression.JPG
    25.4 KB · Views: 509
JJacquelin said:
You are lucky. After some transformations, it can be solved by linear regression (in attachment)

Thanks, I'm at home now, but in your attachment you're missing the 'b' parameter, does that change things?
 
Damn ! I forgot the 'b' !
It doesn't change much : the simple linear regression becomes a multivariate linear regression.
 

Attachments

  • Multivariate linear regression.JPG
    Multivariate linear regression.JPG
    26.3 KB · Views: 474
JJacquelin said:
Damn ! I forgot the 'b' !
It doesn't change much : the simple linear regression becomes a multivariate linear regression.

Thanks! I was able to use that transform to produce a decent fit in MatLab - but I'm wondering, do I have to perform a transform on the error bars too if I want to weight the data?
 
do I have to perform a transform on the error bars too if I want to weight the data?
Yes. Knowing the error ranges on the (xi , yi) it is possible to compute the error ranges on (Xi , Yi , Ti).
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
6
Views
1K
  • · Replies 11 ·
Replies
11
Views
1K
  • · Replies 4 ·
Replies
4
Views
3K