Re: Conceptual Issues with NonlinearRegress[]

• To: mathgroup at smc.vnet.net
• Subject: [mg70970] Re: Conceptual Issues with NonlinearRegress[]
• From: dh <dh at metrohm.ch>
• Date: Fri, 3 Nov 2006 01:39:18 -0500 (EST)
• References: <eicmif\$fki\$1@smc.vnet.net>

```Hi Andrew,

you are trying to fit an implicite function, bu the fitting routines are

made for explicite funtions.

Now, it all depends on the error in your data. If you do not care too

much about errors, your "zero fitting" is o.k. but can be simplified by

using a linear Fit routine, because the problem is linear.

On the other hand, if xi are accurately know and you have measurement

errors in y, you could e.g. solve:

Solve[y^3 + A x1 x2 y^2 + B x3 y + C == 0, y] // Simplify

this gives 3 solutions that you can try to fit, probably only one will

work well.

Daniel

Andrew Fenley wrote:

> Greetings everyone,

>

> I'm trying to use NonlinearRegress[] to determine the values of four

> constants in a 3rd order polynomial. I have a set of 7 data points for the

> polynomial to fit to. My problem arises from the apparent form

> NonlinearRegress[] expects a function to be in. From what I can tell,

> NonlinearRegress[] is expecting the function to have the form:

> f[x1,x2,x3,...,xn] = y and the data points to have the form:

> {x1,x2,x3,...,xn,y}. Unfortunately, my function is a 3rd order polynomial of

> y, example: y^3 + A x1 x2 y^2 + B x3 y + C == 0. With example data points in

> the form: {x1,x2,x3,y}. The constants A, B, and C would be determined from

> NonlinearRegress[]. I did try the following: I used y^3 + A x1 x2 y^2 + B x3

> y + C == 0 and recast the data points to be: {x1,x2,x3,y,0}. However, now

> the function is varying itself in such a way that it is trying to best fit

> to 0 instead of the value y. I'm not sure this is the correct approach to

> take. To further investigate this approach, I looked at the example in the

> Help: Master Index -

>

> data = {{1.0, 1.0, .126}, {2.0, 1.0, .219}, {1.0, 2.0, .076},

> 	  {2.0, 2.0, .126}, {.1, .0, .186}};

>

> BestFitParameters /. NonlinearRegress[

> 		data,

> 		theta1 theta3 x1 / (1 + theta1 x1 + theta2 x2),

> 		{x1, x2},

> 		{theta1, theta2, theta3},

> 		RegressionReport -> BestFitParameters

> ]

>

> Output: {theta1 -> 3.13151, theta2 -> 15.1594, theta3 -> 0.780063}

>

> I changed this to:

>

> data = {{1.0, 1.0, .126, 0}, {2.0, 1.0, .219, 0}, {1.0, 2.0, .076, 0},

> 	  {2.0, 2.0, .126, 0}, {.1, .0, .186, 0}};

>

> BestFitParameters /. NonlinearRegress[

> 		data,

> 		(theta1 theta3 x1 / (1 + theta1 x1 + theta2 x2)) -y,

> 		{x1, x2, y},

> 		{theta1, theta2, theta3},

> 		RegressionReport -> BestFitParameters

> ]

>

> Output: NonlinearRegress::bdfit: Warning: unable to find a fit that is

> better than the mean response.

>

> {theta1 -> 3.13151, theta2 -> 15.1594, theta3 -> 0.780063}

>

> The "answer" appears to be the same, but now there is a warning attached to

> it.

>

> Any help and / or insight would be greatly appreciated.

>

> Cheers,

> Andrew Fenley

>

```

• Prev by Date: Re: Context
• Next by Date: Re: Curiosity concerning transformation rules for List
• Previous by thread: Conceptual Issues with NonlinearRegress[]
• Next by thread: Re: Weights option to Regress command not behaving as expected