MathGroup Archive 2001

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

Search the Archive

Re: conditionals during nonlinear regression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28426] Re: [mg28420] conditionals during nonlinear regression
  • From: BobHanlon at aol.com
  • Date: Wed, 18 Apr 2001 03:23:29 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Make ds a parameter of the model

model = (2-ds)*(a1*Exp[m]+b1)+(ds-1)*(a2*Exp[m]+b2);

model /. {{ds -> 1}, {ds -> 2}}

{E^m*a1 + b1, E^m*a2 + b2}

model = (2-ds)*(3-ds)*(a1*Exp[m]+b1)/
          2+(ds-1)*(3-ds)*(a2*Exp[m]+b2) + (ds-1)*(ds-2)*(a3*Exp[m]+b3)/2;

model /. {{ds -> 1}, {ds -> 2}, {ds -> 3}}

{E^m*a1 + b1, E^m*a2 + b2, 
  E^m*a3 + b3}

Bob Hanlon

In a message dated 2001/4/17 1:48:08 AM, baker at fas.harvard.edu writes:

>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?
>


  • Prev by Date: MatrixTemplate (Generalization)
  • Next by Date: Bug in Integrate?
  • Previous by thread: Re: conditionals during nonlinear regression
  • Next by thread: MatrixTemplate (was SpecialMatrix)