MathGroup Archive 2000

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

Search the Archive

Re: Re: problem with nonlinearfit

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25585] Re: [mg25578] Re: [mg25489] problem with nonlinearfit
  • From: "Mark Harder" <harderm at ucs.orst.edu>
  • Date: Mon, 9 Oct 2000 21:43:26 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dragan,
    A rough answer to your question:

>Why the y variable of a function y=f(x) must have a reduced range of values
to perform a nonlinear fit?

    Because the part of NonlinearRegress that calculates step sizes needs to
invert the curvature matrix of the problem, and that matrix depends on the
scales of the different parameters in the parameter vector.  The routine
doesn't "know" anything about the units in which those parameters are
expressed, it only "sees" a matirx of elements that are, maybe, different in
magnitude by 10^10, or something, so the problem of inverting the matrix is
unstable, and it either catches this problem and generates an error msg., or
it goes ahead and calculates an unreasonable step size, sending your search
into the nether reaches of parameter space, where, maybe, your model
function could take on even imaginary values, or whatever.
     This is commonly a problem when fitting chemical models with chemical
data, where one is trying to determine equilibrium constants that could be
very small, or very much larger than one.  In this case, it is better to
express the model in terms of standard free energies, which are proportional
to Ln[equilibrium constant], which compresses those parameters.
    I suspect that since converting some of your parameters to logs has
helped you, you might be having the same problem.  Either use logs, or scale
linearly (see a reference on nonlinear regression, or optimization, for a
discussion).
-mark harder



-----Original Message-----
From: Dragan Grgic <Dragan.Grgic at ensg.inpl-nancy.fr>
To: mathgroup at smc.vnet.net
Subject: [mg25585] [mg25578] Re: [mg25489] problem with nonlinearfit


>Thank you for your answer Timothy,
>but I have already realized that it is not possible to specify a range to
>use for parameter values in NonlinearFit (or NonlinearRegress). In fact,
the
>problem seems to be the difference between values of the two variables (e
>and t):
>e is the deformation and its range is: 0 to 10^-5 (without unit)
>t is the time and its range is: 0 to 10^6 seconds
>a and N are exposants: 0,2 to 1 for a and ~5 for N.
>For the time it is possible to use an other unit (days for example); then
>the range of the unit is: 0 to 10 days.
>For the deformation, the only solution is to use a reduced variable (i.e.
>e'=e*100000). Then the parameter K is reduced too. But mathematica reports
>always the same error messages:
>"Objetive function or gradient is not real at {K,N,A}={in general starting
>values}"
>The final solution that I have found is to use the Log function (logarithm
>to base e) for the variable e', then the function is: Log[e'] =
>Log[(s/K')^(Na)*(t/a)^a]
>The Logarithm makes it possible to reduce the range of the e' variable (~0
>to ~5). Then, all the variables and all the parameters are of the same
>order; and the program work well.
>Why the y variable of a function y=f(x) must have a reduced range of values
>to perform a nonlinear fit?
>
>Thanks, Dragan.
>
>
>
>
>----- Original Message -----
>From: "Timothy Stiles" <tastiles at students.wisc.edu>
To: mathgroup at smc.vnet.net
>To: mathgroup at smc.vnet.net
><mathgroup at smc.vnet.net>
>Subject: [mg25585] [mg25578] Re: [mg25489] problem with nonlinearfit
>
>
>> I'm not sure if it's possible to specify a range to use for parameter
>> values in NonlinearFit, but it is possible to specify starting values by
>> giving a list of {parameter, starting value} instead of just a list of
>> parameters. It may be an "undocumented" feature, but it seems to work
>well.
>> For instance if your data is contained in the variable data and the
>> function is as you describe, you could use
>>
>> NonlinearFit[data, (s/K)^(N a)*(t/a)^a, t, {{K, 5}, {N, 7}, {a, 9}}]
>>
>> if you wanted to start the fit with K=5, N=7, a=9. You could use any
other
>> starting values for the parameters, but if you want to specify a starting
>> value for one parameter, you have to specify a starting value for all
>> parameters, you can's use the following
>>
>> NonlinearFit[data, (s/K)^(N a)*(t/a)^a, t, {{K, 5}, N, a}]
>>
>> to specify a starting value for K but not for N or a.
>>
>> Since Mathematica does not have a constrained minimization function, it
>may
>> not be possible to specify a "range" for the parameters.
>>
>> -- Tim Stiles
>>
>> Dragan Grgic wrote:
>>
>> > Hi everybody,
>> >
>> > I have to fit the function e = (s/K)^(Na)*(t/a)^a    (s = constant;
>> > t = variable; K,N,a = parameters) to a given set of datas.
>> > Then, I have used the NonlinearFit function (Statistics'NonlinearFit'
>> > package), but I have two problems:
>> >
>> > 1) I can't specify any start values or range using. I tried to give
them
>> > as any forms, but I always got error messages concerning these
>> > parameters.
>> >
>> > 2) mathematica shows kind of a strange behavior when repeating the fit
>> > operation, sometimes it keeps old values and sometimes it reports
>> > different error messages.
>> >
>> > Any help welcome,
>> > Thanks in advance, Dragan.
>>
>>
>
>
>



  • Prev by Date: RE: Graphing Hyperboloids
  • Next by Date: Re: advanced keystroke remapping
  • Previous by thread: Re: problem with nonlinearfit
  • Next by thread: Re: Re: problem with nonlinearfit