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

In summary, the conversation involves a person seeking advice on how to perform a best least-squares fit on a set of data described by a specific equation. They mention constant parameters and ask for advice on how to proceed. The other person provides a solution involving linear regression and mentions that the 'b' parameter was initially forgotten. They also mention the need to transform error bars in order to weight the data.
  • #1
pergradus
138
1
Hi, I am trying to do a best least-squares fit to a set of data which is described by the following equation:

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

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
  • #2
You write ln(c/x)²
does it mean
(ln(c/x))² = (ln(x/c))²
or
ln((c/x)²) = -2 ln(x/c)
?
 
  • #3
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.
 
  • #4
You are lucky. After some transformations, it can be solved by linear regression (in attachment)
 

Attachments

  • Regression.JPG
    Regression.JPG
    25.4 KB · Views: 429
  • #5
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?
 
  • #6
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: 404
  • #7
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?
 
  • #8
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).
 

1. What is the concept of least squares fit?

Least squares fit is a statistical method used to find the line of best fit for a set of data points. It minimizes the sum of the squared distances between the data points and the line, making it the most accurate representation of the relationship between the variables.

2. How is the least squares fit calculated?

The least squares fit is calculated by finding the slope and intercept of the line that minimizes the sum of the squared distances between the data points and the line. This is typically done using a mathematical formula or computer program.

3. What is the purpose of least squares fit?

The purpose of least squares fit is to find the most accurate representation of the relationship between two variables in a set of data points. It is commonly used in fields such as statistics, economics, and engineering to make predictions and analyze trends.

4. What are the limitations of least squares fit?

One limitation of least squares fit is that it assumes a linear relationship between the variables. If the relationship is non-linear, the least squares fit may not accurately represent the data. Additionally, it can be sensitive to outliers in the data, which can skew the results.

5. How is least squares fit used in real-world applications?

Least squares fit is used in a variety of real-world applications, such as predicting stock prices, analyzing economic trends, and fitting curves to experimental data. It is also commonly used in machine learning algorithms to find the best fitting model for a given set of data.

Similar threads

Replies
4
Views
1K
  • General Math
Replies
6
Views
792
Replies
19
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
6
Views
649
  • General Math
Replies
19
Views
5K
  • Programming and Computer Science
Replies
4
Views
653
  • General Math
Replies
5
Views
1K
Replies
10
Views
3K
  • General Math
Replies
2
Views
2K
Back
Top