MathGroup Archive 2012

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

Search the Archive

Re: NonlinearModelFit to multiple data sets simultaneously?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127168] Re: NonlinearModelFit to multiple data sets simultaneously?
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Thu, 5 Jul 2012 06:10:11 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

On 7/4/12 at 3:35 AM, google at dantimatter.com (dantimatter) wrote:

>Hello All, I'd like to fit the following model to time series data
>I've collected:

>- ArcTan[( Sqrt[K1/K2] (t0 - t) ) / Sqrt[K1*K2]

>where K1, K2, and t0 are unknown parameters.  Currently I'm using
>NonlinearModelFit to independently extract each of these parameters
>from five different datasets, even though the only parameter
>expected to change between the datasets is K1.  Is there a way to
>NonlinearModelFit to all the data at once to find the single values
>of t0 and K2 that give best fit to all, while still allowing K1 to
>'float'?

If by float you mean solve for t0 and K2 without specifying a
value for K1, then no, it is not possible to do this with
NonlinearModelFit or other similar functions since these are
numeric functions that require all symbols to get assigned
values. So, if one of the model parameters varies between the
data sets, the only way to find global values would be to say
something about how the one parameter varies.

Your post suggests you have found values for the model
parameters for each of you 5 data sets. So, do you know how K1
varies between the sets? Suppose K1 has a simple linear
variation between the data sets, i.e., K1 = a n + b for n = data
set number and unknown parameters a,b.

I assume your data sets are lists of {t, response} pairs. If K1
has a linear characteristic as described above, take the data
set with the smallest K1 value and change it to be
{t,1,response}, i.e., introduce a new variable into your model
which is the rank of K1 over the data sets. Then substitute a n
+ b for K1 in your model above and use NoninearModelFit to find
values for K2,t,a and b for the combined data.

Or if there isn't any obvious way to specify how K1 varies from
data set to data set change your data sets from {t, response}
pairs to {t, K1, response} triplets using the numeric value for
K1 you've already found for each data set. After doing this you
can use the same model you posted but specify K1 as a variable
rather than a model parameter. This will clearly result in
values of K2 and t near the values you already found and can be
thought of as some sort of weighted average for K2 and t over
all of your data sets. Seems like a quicker and equally valid
approach would be to take K2 and t as the average value over all
of your data sets.

It is also possible to create a model without either appending
values for K1 or specifying how K1 varies between data sets,
Suppose you had only two data sets rather than 5. Take the first
data set and change data elements in it from {t, response} to
{t. 1. 0, response} and data elements of the second data set
would become {t, 0, 1, response}. Now substitute a K11 + b K12
for K1 in your model above. What this does is create indicator
variables {a,b) into the model. For each data set a K11 + b K12
reduces to K11 or K12, allowing different values for K1 for each
data set.

This last approach can be extended to any number of variables.
But, this increases the complexity of the model quite a bit and
will impact execution time. Additionally, it may create
convergence problems for non-linear models. Again, simply
averaging t and K2 values you've already computed is likely to
be far faster and quite possibly yield estimates for t and K2
that are as good as any that result from the methods described above.




  • Prev by Date: Re: Higher precision in Error function Erf[] needed.
  • Next by Date: Re: Evaluate code fragment without making new cell for it?
  • Previous by thread: NonlinearModelFit to multiple data sets simultaneously?
  • Next by thread: Re: NonlinearModelFit to multiple data sets simultaneously?