MathGroup Archive 2001

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

Search the Archive

Re: conditionals during nonlinear regression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg28421] Re: [mg28420] conditionals during nonlinear regression
  • From: "Mark Harder" <harderm at ucs.orst.edu>
  • Date: Wed, 18 Apr 2001 03:23:24 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Brian,
    Since you don't provide the error message(s) you were given or your
relevant code, its a little hard to give a definite answer.  It sounds like
you want to provide NonlinearRegress with a numerical list in the required
form, in which x1,x2,x3 *and* ds are the independent variables.  However,
your failure to list ds as an independent variable along x1,x2, & x3 makes
me think you might not have handled the listing of the numeric values and/or
the symbolic variable list correctly.  When you use ds as the deciding
variable in the If[], you must list it as part of the 3rd argument to
NonlinearRegress, ie {x1,x2,x3,ds}.  Next, you must make sure that the model
function uses these exact symbols as its independent variables, otherwise,
Mathematica won't "know" which column of your data matrix goes where in your
model (I mention this because you didn't include x1,x2,x3 in your example
function.)  And, finally, your data matrix does have 1,1,1,...., 2,2,2... as
the values in the 4th column doesn't it?
    If you have already followed these instructions, and Mathematica is
still upset with you, you might have to provide us with more info, assuming
no one else comes up with the solution.
-mark harder
harderm at ucs.orst.edu


-----Original Message-----
From: news.fas.harvard.edu <baker at fas.harvard.edu>
To: mathgroup at smc.vnet.net
Subject: [mg28421] [mg28420] conditionals during nonlinear regression


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



  • Prev by Date: Summation Formulae Table
  • Next by Date: Re: Can Mathematica be used as expert system (rule-based computations like CLIPS?)
  • Previous by thread: conditionals during nonlinear regression
  • Next by thread: Re: conditionals during nonlinear regression