Re: Getting parameters from Fit[]..

• To: mathgroup at smc.vnet.net
• Subject: [mg27101] Re: [mg27055] Getting parameters from Fit[]..
• From: BobHanlon at aol.com
• Date: Sun, 4 Feb 2001 02:58:27 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

Needs["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}};

funcs = {1, x, x^2};

bfp=(BestFitParameters /.
Regress[data, funcs, x, RegressionReport -> BestFitParameters]);

bfp.funcs == Fit[data, funcs, x]

True

funcs = {1, x^2};

bfp=(BestFitParameters /.
Regress[data, funcs, x, RegressionReport -> BestFitParameters]);

bfp.funcs == Fit[data, funcs, x]

True

Bob Hanlon

In a message dated 2001/2/3 5:25:07 AM, harderm at ucs.orst.edu writes:

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

• Prev by Date: Re: Parametric Plot
• Next by Date: Re: Getting parameters from Fit[]..
• Previous by thread: Re: Getting parameters from Fit[]..
• Next by thread: Re: Getting parameters from Fit[]..