Re: problem with nonlinearfit
- To: mathgroup at smc.vnet.net
- Subject: [mg25578] Re: [mg25489] problem with nonlinearfit
- From: "Dragan Grgic" <Dragan.Grgic at ensg.inpl-nancy.fr>
- Date: Mon, 9 Oct 2000 01:16:43 -0400 (EDT)
- References: <200010060350.XAA24764@smc.vnet.net> <39DDFC2D.446BC2DD@students.wisc.edu>
- Sender: owner-wri-mathgroup at wolfram.com
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 <mathgroup at smc.vnet.net> Subject: [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. > >
- References:
- problem with nonlinearfit
- From: "Dragan Grgic" <Dragan.Grgic@ensg.inpl-nancy.fr>
- problem with nonlinearfit