How to create a parametric equation for a curve using data points

838 Views Asked by At

After performing a loess regression I have a set of points that predict a curve and I would like to create a parametric function that would fit this curve with a good degree of accuracy, but i'm not sure how. How would I create the equation? The output data below is for an input of 0 to 9.9 intervals are set at 0.1

To be clear, I'm not looking to perform another regression, I want an equation that I can write in the form f(x)=....

1.003883 1.005017 1.006127 1.007213 1.008276 1.009313 1.010323 1.011307 1.012268 1.013208 1.014128 1.015031 1.015917 1.016774 1.017589 1.018366 1.019108 1.019821 1.020507 1.021173 1.021821 1.022456 1.023082 1.023704 1.024326 1.024951 1.025585 1.026216 1.026836 1.027445 1.028046 1.028640 1.029231 1.029819 1.030407 1.030996 1.031590 1.032189 1.032795 1.033411 1.034039 1.034677 1.035314 1.035950 1.036584 1.037219 1.037854 1.038489 1.039126 1.039764 1.040404 1.041046 1.041691 1.042340 1.042992 1.043649 1.044310 1.044975 1.045643 1.046313 1.046986 1.047660 1.048335 1.049011 1.049687 1.050363 1.051040 1.051715 1.052390 1.053063 1.053735 1.054404 1.055071 1.055736 1.056397 1.057054 1.057709 1.058364 1.059017 1.059670 1.060322 1.060972 1.061622 1.062272 1.062920 1.063568 1.064214 1.064860 1.065505 1.066150 1.066793 1.067436 1.068078 1.068719 1.069360 1.069999 1.070638 1.071277 1.071914 1.072551

Plotted Curve

2

There are 2 best solutions below

4
On

This is a problem for a computer. In Mathematica:

data = {1.003883, 1.005017, 1.006127, 1.007213, 1.008276, 1.009313, 
  1.010323, 1.011307, 1.012268, 1.013208, 1.014128, 1.015031, 
  1.015917, 1.016774, 1.017589, 1.018366, 1.019108, 1.019821, 
  1.020507, 1.021173, 1.021821, 1.022456, 1.023082, 1.023704, 
  1.024326, 1.024951, 1.025585, 1.026216, 1.026836, 1.027445, 
  1.028046, 1.028640, 1.029231, 1.029819, 1.030407, 1.030996, 
  1.031590, 1.032189, 1.032795, 1.033411, 1.034039, 1.034677, 
  1.035314, 1.035950, 1.036584, 1.037219, 1.037854, 1.038489, 
  1.039126, 1.039764, 1.040404, 1.041046, 1.041691, 1.042340, 
  1.042992, 1.043649, 1.044310, 1.044975, 1.045643, 1.046313, 
  1.046986, 1.047660, 1.048335, 1.049011, 1.049687, 1.050363, 
  1.051040, 1.051715, 1.052390, 1.053063, 1.053735, 1.054404, 
  1.055071, 1.055736, 1.056397, 1.057054, 1.057709, 1.058364, 
  1.059017, 1.059670, 1.060322, 1.060972, 1.061622, 1.062272, 
  1.062920, 1.063568, 1.064214, 1.064860, 1.065505, 1.066150, 
  1.066793, 1.067436, 1.068078, 1.068719, 1.069360, 1.069999, 
  1.070638, 1.071277, 1.071914, 1.072551};

fitfun = Fit[data, {1, x, x^2, x^3}, x]

$1.0453 + 0.0008714 x - 4.4225 \times 10^{-6} x^2 + 2.59026 \times 10^{-8} x^3$

Show[
 ListPlot[data, PlotStyle -> Red], 
 Plot[fitfun, {x, 0, 100}]
 ]

enter image description here

Obviously if you want a better fit, use more terms:

If you use fitfun = Fit[data, {1, x, x^2, x^3, x^4, x^5, x^6}, x]

you get:

enter image description here

0
On

As David G. Stork answered, fitting data with polynomials is a quite easy task (you can do it using Excel).

You also could use fitting techniques with rational approximations, the model being $$y=\frac{\sum_{i=0}^n a_ix^i}{1+\sum_{i=1}^m b_ix^i}$$ selecting the degrees $m,n$ of numerator and denominator.

Looking at your data, which look to be quite linear for the large values of $x$, it seems that $m=n-1$ could be a good idea.

So, using $n=3$ (as David G. Stork did in his first example) and $m=2$, the adjusted model is $$y=\frac{1.00314-0.0503071 x+0.00380452 x^2+2.59032\times 10^{-6}x^3}{1-0.0510772 x+0.00382303 x^2}$$ for which all parameters are highly significant from a statistical point of view.

Remark : as tehy have been used, your data are supposed to start at $x=1$ and not at $x=0$ with an increment of $1$. So, for the first fit, the first $y$ is predicted to be $1.00540$ and $1.00409$ for the second model (to be compared to the experimental value $1.003883$.