conditionals during nonlinear regression
- To: mathgroup at smc.vnet.net
- Subject: [mg28420] conditionals during nonlinear regression
- From: "news.fas.harvard.edu" <baker at fas.harvard.edu>
- Date: Mon, 16 Apr 2001 23:54:23 -0400 (EDT)
- Organization: Harvard University, Cambridge, Massachusetts
- Sender: owner-wri-mathgroup at wolfram.com
Greetings all, I'm new at this so please try to bear with me.
I'm trying to use NonlinearRegress to simultaneously fit multiple datasets,
each dataset described by some global (shared) parameter as well as local
parameters. I have one big list of the type {x1,x2,x3,ds,y}, where x1-x3 are
independent variables for each dataset, and ds indicates the dataset number.
In the old-fashioned fortran and C fitting packages I used to use, I just
used If statements to test which dataset was being fitted and setup the
function appropriately. If I try to do this with Mathematica, it yells at
me. For a basic example, if I have two datasets with ds=1 or 2, I try as the
fitting function
If[ds==1,a1*Exp[m]+b1,a2*Exp[m]+b2]
I can fit data just fine if I limit things to one dataset and leave out the
conditional statements. But anything more complicated doesn't work. Any
advice?
Thanks,
-Brian
baker at crystal.harvard.edu