MathGroup Archive 2001

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

Search the Archive

Re: Getting parameters from Fit[]..

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27089] Re: Getting parameters from Fit[]..
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sun, 4 Feb 2001 02:58:15 -0500 (EST)
  • References: <95gkss$8do@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Mark

The output from Regress is actual output, not print, so we can use any of
the information given in further computation.
Also we can specify what we want to appear in the report:

<<Statistics`LinearRegression`

data = {{0.055, 90}, {0.091, 97}, {0.138, 107},
 {0.167, 124}, {0.182, 142}, {0.211, 150},
 {0.232, 172}, {0.248, 189}, {0.284, 209},
 {0.351, 253}};


rpt = Regress[data, {1, x}, x, RegressionReport->{BestFitParameters}]

{BestFitParameters\[Rule]{39.6484,580.151}}

params = BestFitParameters/.rpt

{39.6484,580.151}

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Mark Harder" <harderm at ucs.orst.edu> wrote in message
news:95gkss$8do at smc.vnet.net...
>
>     I am doing a linear fit to obtain parameters for use in a larger,
> iterative procedure (a separable linear-nonlinear data fitting
> algorithm), and I'm trying to use Fit[] to do this.  Unfortunately, Fit
> does not return parameters by themselves, just the linear combination of
> my basis functions(which are much more complicated than the usual
> examples given in the documentation) weighted by the parameters.  I have
> tried various things, like using Regress instead of Fit, but that prints
> out at least a written report of the parameters every time it is
> invoked, which will make for a very cluttered output when included in
> the larger problem I am trying to solve.  I suppose I can find a method
> to isolate just the parts of the output of Fit that contain the
> parameters and process them to get the parameters, but that seems
> awkward and might introduce numerical errors.  I've looked at the
> MathGroup archives and found only 1 response to this question in the
> past, which was "Sorry, dont know how to do that. why don't you use
> Regress?".
>     Doesn't Mathematica provide any simple method for recovering just
> the parameter vector from a linear fit?  If it doesn't, perhaps it ought
> to.  Alternatively, is there some way to get Regress to provide the
> BestFitParameters rules without printing them out?  Or, is there some
> *simple* and accurate way of getting the parameters from the Fit output
> as is?
> -mark harder
> harderm at ucs.orst.edu
>




  • Prev by Date: AW: LogPlot/Plot-Identity
  • Next by Date: Re: Appending to Lists
  • Previous by thread: Re: Getting parameters from Fit[]..
  • Next by thread: Re: Getting parameters from Fit[]..