Conceptual Issues with NonlinearRegress[]
- To: mathgroup at smc.vnet.net
- Subject: [mg70936] Conceptual Issues with NonlinearRegress[]
- From: Andrew Fenley <nekonunu at gmail.com>
- Date: Thu, 2 Nov 2006 06:47:22 -0500 (EST)
- Reply-to: <afenley at vt.edu>
- Thread-index: Acb907TEbFiUQslOSGe8+alxzOoECg==
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