Least Square Fit of Multiple Measurements with Shared Parameters

Click For Summary

Discussion Overview

The discussion revolves around the challenge of performing a least squares fit of multiple measurements using several nonlinear functions that share parameters. The focus is on finding an appropriate algorithm, such as Gauss-Newton, to fit multiple datasets in parallel while maintaining shared parameters across the functions.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant seeks an algorithm to fit multiple datasets to nonlinear functions with shared parameters, specifically using Mathematica.
  • Another participant suggests minimizing the sum of all functions' chi-squared values as a single number, which could simplify the problem to a multi-dimensional minimization.
  • A participant expresses difficulty in generating the Jacobian matrix for their approach and seeks literature that details the problem.
  • Another participant mentions that there are multi-dimensional minimization algorithms, like the downhill simplex method, that do not require the calculation of the Jacobian.
  • One participant describes a similar problem where they concatenated datasets and used a single fit function, noting that other software packages may handle such problems more directly.
  • The original poster expresses gratitude for the information received and indicates they feel equipped to proceed with fitting the data.

Areas of Agreement / Disagreement

Participants share various approaches and suggestions, but there is no consensus on a single method or solution. Multiple competing views on how to tackle the fitting problem remain present.

Contextual Notes

Participants discuss the complexity of generating the Jacobian matrix and the potential for different algorithms to handle the fitting process. There are references to specific methods and software, but no definitive solution is established.

Sebastian.de
Messages
3
Reaction score
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
 
Physics news on Phys.org


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.
 


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
 


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" is a good implementation of this algorithm in the Gnu Science Libraries
 
Last edited by a moderator:


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



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
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
1K
Replies
6
Views
1K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
Replies
7
Views
3K
  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K