Re: fitting a function

*To*: mathgroup at smc.vnet.net*Subject*: [mg58362] Re: [mg58323] fitting a function*From*: "David Park" <djmp at earthlink.net>*Date*: Tue, 28 Jun 2005 21:56:56 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Darrell, First, get rid of the commas in your data. data = {{10000, .3}, {15000, .5}, {20000, .6}, {25000, .65}}; << NumericalMath`PolynomialFit` poly = PolynomialFit[data, 3] FittingPolynomial[<>, 3] Plot[poly[x], {x, 10000, 25000}, Epilog -> {AbsolutePointSize[5], Point /@ data}, Frame -> True, ImageSize -> 450]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Bosch, Darrell [mailto:bosch at vt.edu] To: mathgroup at smc.vnet.net Dear Group, I have two questions: First, I want to fit a function relating utility to income based on some elicited data. For example, the following pairs might represent the income and utility values for an individual: {10,000, .3}, {15,000, .5}, {20,000, .6}, {25,000, .65} I want to fit the data to a function and plot the resulting function. What is the best way to do this? PolynomialFit seems like a logical choice, but it's not clear to me from the documentation how to specify the command for a series of pairs of points. Second, how do I plot the resulting value of a polynomial fit in the example below? My 'ParametricPlot' command doesn't do the job. Thanks in advance for your help. Darrell Bosch << "NumericalMath`PolynomialFit`" In[28]:= p = PolynomialFit[{1, 4, 9, 16, 25, 36, 49}, 3] ParametricPlot[p, {p, 0, 6}, PlotRange -> All, Compiled -> True]