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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Martin Beseda
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

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: [FORGED] How to fit the following data and get the equation describing them?

Rolf Turner
On 2/13/19 12:33 PM, Martin Beseda wrote:

> 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.

You seem to be way out of your depth.  You would be well advised to seek
local help from a qualified statistician.

cheers,

Rolf Turner

--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: [FORGED] How to fit the following data and get the equation describing them?

Jeff Newmiller
To elaborate on Rolf's suggestion... the data you have does not look like the LJ plot on the referenced web page... You should be investigating the nature of this data and how it is really supposed to relate to potential energy physics before putting it into a numerical meat grinder. Garbage in gets you garbage out.

As for an alternative to splines... linear or nonlinear regression is one of the more common uses of statistics and R, but it is not without its pitfalls. You _could_ read the Introduction to R document that comes with R... but it would only tell you the mechanics of getting R to perform regression without informing you how to judge whether the result makes any sense at all. For that you need some local help and/or a college course on regression.

On February 12, 2019 5:16:12 PM PST, Rolf Turner <[hidden email]> wrote:

>On 2/13/19 12:33 PM, Martin Beseda wrote:
>> 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.
>
>You seem to be way out of your depth.  You would be well advised to
>seek
>local help from a qualified statistician.
>
>cheers,
>
>Rolf Turner

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.