Author |
Topic  |
|
giordandue
Italy
Posts |
Posted - 12/12/2018 : 03:27:18 AM
|
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2016 sr2 Operating System:Windows 10
Hello, is it possible to calculate the correlation coefficient of a given (linear) function? In the specific case, I have data point and I would calculate how well the simple function y=0.5x correlates the data. Thank you in advance |
|
JacquelineHe
287 Posts |
Posted - 12/12/2018 : 05:39:39 AM
|
Hi,
If you do the Linear Fit ("Analysis: Fitting: Linear Fit" menu) for your datasets, you will get the "Pearson's r" (Pearson correlation coefficient) in the report sheet.
Thanks Originlab Jacqueline
|
 |
|
giordandue
Italy
Posts |
Posted - 12/13/2018 : 03:01:49 AM
|
Hi Jaqueline, I think you have not understood my question. I do not want to do a linear fitting of the data, but, if possible, to calcolate the correlation coefficient for a given function (in the case Y=0.5X). In other word, let we assume that Y=0.3X is the best linear fitting of the data with R2=0.8: I would calculate R2 for Y=0.5X. Thank you in advance |
 |
|
JacquelineHe
287 Posts |
|
giordandue
Italy
Posts |
Posted - 12/13/2018 : 09:15:16 AM
|
Hi Jaqueline, your suggestion appears as quite complicate and requiring tools that I have not available. Is there not other available method to check how well a defined function fits data? Regards |
 |
|
YimingChen
1684 Posts |
Posted - 12/13/2018 : 10:46:45 AM
|
Hi,
You could use Nonlinear Curve fitting tool to achieve that. In NLFit dialog, you can change the parameters of the fitting function. Then instead of performing a fitting, just click Done button, it outputs the R^2 with current parameter settings. This way you can update your function and check it's correlation with your data.

Hope this works for you. Thanks. James |
 |
|
giordandue
Italy
Posts |
Posted - 12/14/2018 : 01:27:37 AM
|
Thank you very much James.. It seems to works, but I have to understand the meaning of the resulting negative values of both R-square and Adjusted R-square and how to manage it... I add the figure of the fitting result, for the function y=0.5x I have forced:

Kind Regards Giordano |
 |
|
YimingChen
1684 Posts |
Posted - 12/14/2018 : 09:11:17 AM
|
Hi Giordano,
So basically the purpose of regression is to use a model to explain the variation of the data. R^2 is the ratio of explained variation to the total variation of the data. If you look at eqn 21 on this page for the definition of R^2, https://www.originlab.com/doc/Origin-Help/NLFit-Theory#R-Square_.28COD.29
a negative R^2 means the residual variation (RSS) is even larger than the total variation (TSS) , which means the model doesn't help in explaining your data. Hope this answers your question. Thank you.
James
|
 |
|
giordandue
Italy
Posts |
Posted - 12/14/2018 : 09:28:45 AM
|
Thank you a lot James! Greetings from Italy Giordano |
 |
|
|
Topic  |
|