Least Square Fit of Multiple Measurements with Shared Parameters

In summary, the conversation discussed the issue of fitting a number of measurements using several nonlinear functions with shared parameters, similar to advanced fitting in Origin, using Mathematica. The desired approach was to use an algorithm like Gauss-Newton that fits several data-sets to several functions in parallel. However, the individual discussing the issue was having difficulty finding a suitable algorithm and had limited experience with matrix calculations. The conversation concluded with suggestions of using multi-dimensional minimization algorithms, such as downhill simplex method, and providing sample code to help with the fitting process.
  • #1
Sebastian.de
3
0
Dear All,

I would like to least square fit a number of measurements using several nonlinear functions with shared parameters (similar to the advanced fitting in Origin) using Mathematica.
Therefor I would be interested in an Algorithm like Gauss-Newton that fits several data-set to several functions (with shared parameters) "in parallel".
For example, I would like to fit the set of functions f1=a*exp(c1/x) ... fn=a*exp(cm/x) to a number of giving data-sets y1(x1,...,xm) ... yn(x1,...,xm). As indicated all "a" in f1...fn should have the same value while c1...cn differ.
Unfortunately, I can not find a suited algorithm on the Internet and I have a hard time adopting the algorithms fitting one function to one set of data.
I would appreciate any help, links or references that cover the given topic.

Thank you very much for your help!


Sebastian
 
Mathematics news on Phys.org
  • #2


I may have misunderstood your question, but the simplest thing I can think of is to consider the sum of all your functions [tex]\chi^2[/tex]'s as a single number and minimise that over all the parameters in all of your functions. Then this reduces to a regular multi-dimensional minimisation.

This assumes that you are weighting all your functions equally in the fit, but you could add weights to the different [tex]\chi^2[/tex]'s if that was relevant to your problem.
 
  • #3


Thank you very much for your reply. You didn't misunderstand my question. The approach you suggested seems perfectly fine to me. However, when I tried it I got stuck when generating the Jacobi-matrix.
I hardly have any experience in dealing with matrix calculation, so I am not sure if I ran into a big problem or if I am just to stupid to see the obvious.
The algorithms I found dealing with the least linear square problem generally proceeded in a way that minimizes the sum(f(x,parameters)-y)^2 (where f(x) is the fit function and y are the data points) by making up the Jacobi-matrix of (f(x,parameters)-y) with respect to the parameters. The square is then introduced by multiplying the Jacobi-matrix with its transpose.
If I understand your suggestion correct, I would end up minimizing a problem which looks like this: sum over i (sum(fi(xi,parameters-yi)^2). Having multiple sums of squares now instead of just one, I have not managed to figure out anything similar to the Jacobi-matrix used in the simpler problem. As a result, I was not able to use any of the algorithms I found.
I would be very grateful if you could point me towards any literature that deals with this problem in some detail. I am mildly optimistic that I would be able to write a script solving the problem with the help of a book that illustrates a applicable algorithm on an example.
Thanks again for your help!


Sebastian
 
  • #4


There are multi-dimensional minimisation algorithms that do not require you to calculate the Jacobian. The one that springs to mind is the downhill simplex method, but there are probably others. I've used simplex a fair bit and it usually works well.http://www.gnu.org/software/gsl/manual/html_node/Multidimensional-Minimization.html" [Broken] is a good implementation of this algorithm in the Gnu Science Libraries
 
Last edited by a moderator:
  • #5


I happen to be working on an almost identical problem, although in my case the time constants are common and the amplitudes are not. I took the data sets and time shifted and concatenated them so that they became one long data set. I then created an analytic fit function consisting of a sum of exponentials, each multiplied by two UnitStep functions which "turn it on" during the appropriate time period and turn it off for all other times. Each exponential is multiplied by zero for all times except when it's data is active. Finally, I used the FindFit function to fit the single data set to the single fit function. It would be nice if they had a more straightforward way to do this. A quick Google showed me that other math packages, like SigmaPlot, handle this sort of problem directly. I have attached sample code if you are interested.
 

Attachments

  • double_fit_1a.zip
    98.1 KB · Views: 222
  • #6


Thank you very much to both of you. I think I have all the information I need now to fit the data.
Thanks again!


Sebastian
 

1. What is the purpose of Least Square Fit of Multiple Measurements with Shared Parameters?

The purpose of Least Square Fit of Multiple Measurements with Shared Parameters is to find the best fit line or curve that represents a relationship between multiple variables. This method is commonly used in scientific experiments and data analysis to determine the most accurate and precise values for shared parameters.

2. How does Least Square Fit of Multiple Measurements with Shared Parameters work?

Least Square Fit of Multiple Measurements with Shared Parameters works by minimizing the sum of the squared differences between the measured data points and the predicted values from the fitted line or curve. This is achieved by adjusting the shared parameters to find the best fit that minimizes the overall error.

3. What are the advantages of using Least Square Fit of Multiple Measurements with Shared Parameters?

One of the main advantages of using Least Square Fit of Multiple Measurements with Shared Parameters is that it takes into account all of the data points and their uncertainties, rather than just a few data points. This results in a more accurate and precise fit, especially when dealing with noisy or imperfect data.

4. Are there any limitations to using Least Square Fit of Multiple Measurements with Shared Parameters?

One limitation of Least Square Fit of Multiple Measurements with Shared Parameters is that it assumes a linear relationship between the variables being studied. If the relationship is non-linear, this method may not provide the best fit. Additionally, if the data points have large uncertainties or are not normally distributed, the results may not be reliable.

5. Can Least Square Fit of Multiple Measurements with Shared Parameters be applied to any type of data?

Yes, Least Square Fit of Multiple Measurements with Shared Parameters can be applied to a wide range of data, including experimental and observational data. It is commonly used in fields such as physics, chemistry, engineering, and economics to analyze relationships between variables and make predictions based on data.

Similar threads

  • General Math
Replies
6
Views
757
Replies
4
Views
1K
  • Calculus and Beyond Homework Help
Replies
6
Views
601
  • General Math
Replies
19
Views
5K
Replies
10
Views
3K
  • General Math
Replies
9
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
366
  • General Math
Replies
2
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
  • Programming and Computer Science
Replies
9
Views
2K
Back
Top