The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: problem with NonlinearFit
Replies: 2   Last Post: Sep 16, 1996 10:15 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 1
Registered: 12/11/04
problem with NonlinearFit
Posted: Aug 31, 1996 2:47 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I am having the following problem with the NonlinearFit function, and would
appreciate any tips you might have. (I have appended sample Mathematica code

My goal is to fit a non-monotically decreasing time series with a
monotonically decreasing function (specifically, a sum of decaying
exponenitials plus a constant). I am approaching the problem by using
NonlinearFit and specifying a general functional form, then attempting to
constrain the search to non-negative coefficients and non-positive
exponents. However, in general I have run into the following problems:

(1) NonlinearFit will accept parameter specifications of the form {x,xo}, or
of the form {x,minx,maxx}, but not of the form {x,xo,xmin,xmax}. This means
I can constrain the variables, but I can't start from different points to
test robustness.

(2)The routine stops when it tries to search outside the constraints instead
of continuing the search in a different direction, so that it is important
to be able to specify different initial values to look elsewhere.

I have also tried using MultiplierMethod and posing the problem as a
minimization of least squares errors, but have had even less luck getting
that function to accept constraints (but if you have pointers I would be
happy to use anything that works).

The code is below; any help appreciated.

Brian O'Neill

(* define general functional form - sum of exponentials *)
(* plus a constant, such that all coefficients sum to 1 *)
fn[t_,a1_,a2_,a3_,tau1_,tau2_,tau3_] :=

(* generate data with one negative coefficient to *)
(* produce a bump in the data *)
data = Table[{t,fn[t,0.6,-0.4,0.1,15,30,300]},{t,0,300,10}];

(* take a look at data *)

(* fit data with only positive coefficients allowed, *)
(* supplying no starting points. this gives a solution, *)
(* but I'd like to look for a better one (depending on the *)
(* data, it sometimes stops searching because it exits the *)
(* parameter bounds) *)
soln = NonlinearFit[data,fn[x,a1,a2,a3,tau1,tau2,tau3],

(* try the same fit again, with same constraints on *)
(* parameters but supplying starting points in order *)
(* to find a different solution - but the function won't *)
(* take both starting points and constraints....I can't *)
(* find a syntax that works (this is the syntax give in *)
(* the package documentation), nor can I figure out from *)
(* looking at the package what the problem is. *)
soln = NonlinearFit[data,fn[x,a1,a2,a3,tau1,tau2,tau3],

(* take a look at the fit *)

International Institute for | Email:
Applied Systems Analysis | Phone: +43 2236 807 0
A-2361 Laxenburg, Austria | Fax: +43 2236 71313

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.