[R] How to fit the following data and get the equation describing them?

Martin Beseda m@rt|nbe@ed@ @end|ng |rom @ezn@m@cz
Wed Feb 13 00:33:36 CET 2019


Hello everybody,

I have a following data-set:

     > data$R
      [1] 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 
1.30 1.35 1.40
     [16] 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95 2.00 
2.05 2.10 2.15
     [31] 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.60 2.65 2.70 2.75 2.80 
2.85 2.90 2.95
     [46] 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 
3.60 3.65 3.70
     [61] 3.75 3.80 3.85 3.90 3.95 4.00 4.05 4.10 4.15 4.20 4.25 4.30 
4.35 4.40 4.45
     [76] 4.50 4.55 4.90 4.95
     > data$MRCI8
      [1] 69.10108 56.65276 47.82651 41.64975 37.41315 33.68440 31.29635 
29.75257
      [9] 28.87221 28.34471 27.71358 26.05035 24.95444 24.03100 23.29969 
22.71869
     [17] 22.25380 21.87805 21.56874 21.30299 21.01756 20.61259 20.22289 
19.88496
     [25] 19.59455 19.34637 19.11511 18.94022 18.79525 18.67703 18.58289 
18.51252
     [33] 18.45438 18.41333 18.38730 18.37395 18.37071 18.38427 18.39670 
18.41077
     [41] 18.42544 18.44003 18.45415 18.46754 18.48009 18.49176 18.50254 
18.51246
     [49] 18.52155 18.52988 18.53748 18.54440 18.55068 18.55633 18.56108 
18.59038
     [57] 18.59568 18.60022 18.60429 18.60789 18.61100 18.61363 18.61581 
18.61763
     [65] 18.61914 18.62043 18.62155 18.62256 18.62349 18.62436 18.62520 
18.62602
     [73] 18.62682 18.62761 18.62839 18.62915 18.62990 18.67205 18.67038


I need to fit the data and to get the equation describing the line.

1) I know, I can fit the points using smooth.spline but I have no idea, 
if it's possible to get the equation as y(x) = c_0 + c_1x + c_2x^2.

2) If it's not possible, then I'd like to fit the data with 
Lennard-Jones potential 
(https://en.wikipedia.org/wiki/Lennard-Jones_potential), i.e. with the 
formula

V(r) = 4e * ( (s/r)^12 - (s/r)^6 ),

where 'e' and 's' are the coefficients to be fitted. I have no idea, if 
it's possible to specify the exact position of fitted coefficients, i.e. 
inside the fraction like here.



Could you, please, advise me, how to do any of these things?

Thank you very much.


Best regards,

Martin Beseda



More information about the R-help mailing list