MathGroup Archive 2005

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

Search the Archive

Re: Why this function does not return a single value

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60403] Re: Why this function does not return a single value
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Thu, 15 Sep 2005 05:16:22 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 9/14/05 at 3:27 AM, marekbr at gmail.com (Marek Bromberek) wrote:

>If You run the code from my previous post You will see how my data
>looks like because I adjusted the parameters in the lists a, b,
>\[Delta]L and \[Delta]G so that it represents my data quite well.
>However I want to use NonlinearFit (or FindFit) to find the values of
>those parameters which best represent my data.

We are clearly not communicating effectively. I did run your code and was able to see how the function plots. But this gives me essentially no information as to what to suggest.

When I asked about your data, I was not interested in a plot of your data but the structure of the data files. For example, if I were trying to correlate temperature measurments made in Celsius to temperature measurments in Fahrenheit, I might have a file that looked like

50, 122.5
60, 140.1
70, 158
80, 176.2
90, 194.3

Now since I know there is a linear relationship between Celsius and Fahrenheit I would use FindFit as follows:

FindFit[data, a*T + b, {a, b}, T]

to get

{a -> 1.797,  b -> 32.43}

Here data is an array that contains values of the independent variable as well as the response. And in this particular example, data is set equal to:

{{50, 122.5}, {60, 140.1},{70, 158}, {80, 176.2}, 
  {90, 194.3}}

A non-linear problem or multi-dimensional problem is handled identically. That is I have a data matrix where every row is the values for the independent variables followed by the response, an expression that says how the response is obtained from the independent variables, a list of the symbols used as independent variables and finally the symbol used as the response variable.

There is no limit to how complex I choose to make the expression relating independent variables to response save memory, my patience and the number of distinct data points in the data set.

For example, if I had a suitable number of data points I could have chosen as my expression relating Celsius to Fahrenheit as say

a*T + T^b + c Log[T] +d

Obviously, this will not result in a meaning fit. And in this particular case, FindFit may not be able to achieve convergence.

In your case, the expression showing the relationship between a single independent variable and response could be written as

Voigt[x,a1,b1,dL1,dG1] + Voigt[x,a2,b2,dL2,dG2] + ...

and the corresponding paramater list would be

{a1,b1,dL1,dG1,a2,b2,dL2,dG2,....}

Here I am assuming a data matrix with two columns, the first representing values for a single dependent variable and the second column the response. FindFit can be used with more than one independent variable without difficultly.

However, you described a desire to fit a sum of 15 non-linear functions to the data. And it is beginning to sound like for each of these you need to optimize possibly 4 independent parameters. If I have this correct, then you are likely to be quite fustrated with either FindFit or NonlinearFit.

Fitting non-linear models to data is inherently a difficult problem And the difficulty increases rapidly with the number of non-linear parameters that need to be found. With a large number of parameters ot be found, it will be very difficult to ensure the algortithm used doesn't get trapped by a local minimum giving a sub-optimum solution. Of course, this issue can be largely mitigated by giving FindFit a good set of starting points.

One final comment. You say above you adjusted the paramters to give a good fit to your data. If so, why bother with either FindFit or NonlinearFit at all? What FindFit will do is provide you with another estimate as to the values of the parameters you've effectively already estimated by some other means. The values provided by FindFit or NonlinearFit are likely to be different than the values you've already obtained and *might* be considered "better" under some very specific conditions which often aren't met by real data.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Batch
  • Next by Date: Re: Strange error when using InequalityPlot3D
  • Previous by thread: Re: Why this function does not return a single value
  • Next by thread: solve for a squared variable