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

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:
Mathematics 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: 485
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: 453
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
Views
1K
Replies
19
Views
6K
Replies
2
Views
2K
Replies
5
Views
2K
Replies
1
Views
2K
Replies
2
Views
2K
Back
Top