MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Simultaneous Nonlinear Data Fits

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109081] Re: Simultaneous Nonlinear Data Fits
  • From: danl at wolfram.com
  • Date: Mon, 12 Apr 2010 06:56:54 -0400 (EDT)

> Hello everyone,
>
> A small statement of my problem:  I have 4 data sets consisting of
> spectroscopic data (intensity vs frequency data).  The data contain
> resonant peaks that are fit with the modulus squared of a sum of complex
> functions (one for each peak for a total of 6 peaks) and is such that I
> must use nonlinear fitting algorithms.  Within the four data sets there
> are peaks that should be fit to the same parameters and then there are
> peaks that vary slightly from data set to data set.
>
> The bottom line is this: I am looking for a solution of the form of a
> nonlinear fitting function that is capable of simultaneously fitting
> multiple data sets where some parameters apply to all the data sets and
> others are specific to only one of the data sets.
>
> I have tried fitting each data set independently using the mathematica
> function NonlinearModelFit but the model is such that the
> bestfitparameters can vary wildly from data set to data set.  Using the
> option to constrain leads to computations that never end.  It would be
> best, in my mind, if Mathematica's fitting algorithm was constrained by
> having to minimize the function of the residuals when forced to consider
> all data sets at once.
>
> I am relatively new to mathematica (I have been hacking at it for about
> a year or so) and appreciate any help this group can offer.
>
> Thanks,
>
> -DanO

This came up in house several weeks ago. A way to go about this, suggested
to me by Darren Glosemeyer, is as follows.

(1) Prepend integer indices to your data, so e.g. elements from the third
set of the form {x,y} would become {3,x,y}.

(2) Join the data sets. Call resulting list "alldata", say.

(3) Define the function of the parameters you want to find. Call it
myPeak, say.

(4) Define your several parameter sets. Those that are to be common values
across several sets will simply appear in each of those sets. Take a
simple example of multiple Gaussians with a common variance. Would be
specified as
params1 = {m1,var};
params2 = {m2,var};
...
so they use the same variance parameter "var" but separate mean parameters
"m1", "m2", etc.

(5) Now you can invoke e.g. NonlinearModelFit as

fitall = NonlinearModelFit[alldata,
  KroneckerDelta[index-1]*myPeak[params1] +
   KroneckerDelta[index-2]*myPeak[params2] + ...,
   <list of union of all parameters perhaps with starting values>,
   ...]


Daniel Lichtblau
Wolfram Research








  • Prev by Date: Re: if using Mathematica to solve an algebraic
  • Next by Date: Re: Simultaneous Nonlinear Data Fits
  • Previous by thread: Simultaneous Nonlinear Data Fits
  • Next by thread: Re: Simultaneous Nonlinear Data Fits