Different correlation coefficient results between Matlab and Excel.

In summary, there is a discrepancy in the correlation coefficient results between Matlab and Excel, with Excel returning a higher value (0.801) compared to Matlab (0.786). This may be due to different functions being used (corrcoef for Matlab and Correl for Excel) and subjective aspects of statistics. Additionally, Excel may be rounding the data, causing a difference in the results.
  • #1
honeysyd
3
0
Different correlation coefficient results between Matlab and Excel. Please Help!

I have two sets of dat as below. A problem is that MATLAB and excel returns a different value of correlation coefficient (i.e., 0.801 from Excel and 0.786 from Matlab).

For Matlab, I used the function: corrcoef(DataA, DataB). For excel, I used the function "Correl".

Would you please advise me which one is correct? I found that the excel uses different function from the one used in Matlab. I do not know how to write a function here, so I linked them as below.

http://office.microsoft.com/en-us/excel-help/correl-HP005209023.aspx
http://www.mathworks.com.au/help/techdoc/ref/corrcoef.html

Thank you in advance

Data A
0.56
0.63
0.54
0.59
0.57
0.69

Data B
1.16
1.68
1.24
1.33
1.28
1.52
 
Last edited by a moderator:
Physics news on Phys.org
  • #2


The MATLAB function returns a matrix. Reveal its other entries to us.

Try using MATLAB on the numerical example given in the Excel documentation.

As to "right" vs "wrong", it is always possible for computer code to a have errors. But the difference may also be due to the fact that statistics has subjective aspects. To see that, you must understand the usual scenario for "estimation"

That scenario is:
You have a probability distributions with some unknown parameter (such as the correlation coefficient in a joint distribution of 2 random variables)

You have data.

You do a computation on the data to estimate one of the unknown parameters. The function you use is called "an estimator". For a given parameter, there can be different estimators. Since the data is random, an estimator is a random variable. Different esimatators can have different aspects that argue in favor of using them. It is a subjective decision, which estimator you want to use. The odds are that any estimator will be "wrong" (i.e. not exactly equal to the parameter you are trying to estimate).

To use proper teminology, you should distinguish between an unknown parameter and its estimator and any "standard" related statistic computed from the sample. For example, there is a "population variance", several different "estimators for the population variance" and there is the "sample variance" (which can be defined two different ways, depending on which textbook you use).
 
Last edited:
  • #3


Thank you very much Stephen.

It was a great help. Beside your reply, I found another reason.

Data A appears to be two decimal numbers in excel, but actually Data A is four decimal numbers.

When I copy and paste Data A from Excel to Matlab, only two decimal numbers were copied and pasted, while Excel calculated the correlation coefficient with four decimal number of Data A.


I hope this helps others having a same problem.
 
  • #4


It's hard to say exactly what is happening, but if both Matlab and Excel are calculating the same statistic, the difference may be due to rounding errors. Excel is notorious for things like this.
 
  • #5


Dear researcher,

Thank you for bringing this issue to my attention. As a scientist, it is important to always critically evaluate our results and methods to ensure accuracy and reliability.

Firstly, it is important to note that there are different methods for calculating correlation coefficient, and different software may use different algorithms or assumptions in their calculations. Therefore, it is not uncommon to see slight variations in the results between different software programs.

To determine which result is more accurate, I would recommend conducting a literature search to see if there are any studies that compare the correlation coefficient results between Matlab and Excel. This may give you a better understanding of the differences and help you determine which result is more reliable for your specific data set.

In addition, it may also be helpful to check the documentation for both software programs to see if there are any differences in the way they calculate correlation coefficient. If there are, it may be worth considering which method is more appropriate for your data set.

Finally, it is always a good idea to perform a sensitivity analysis to see how sensitive your results are to changes in the method or software used. This can help determine if the variations in the results are significant or not.

In conclusion, while it is important to strive for consistency in our results, it is also important to acknowledge that there may be slight variations between different software programs. I recommend conducting further research and sensitivity analysis to determine which result is more accurate for your specific data set.
 

Related to Different correlation coefficient results between Matlab and Excel.

1. Why are the correlation coefficient results different between Matlab and Excel?

This could be due to a variety of reasons, such as differences in the algorithms used to calculate the coefficient, differences in the data being analyzed, or rounding errors in the calculations.

2. Which software should I trust for calculating correlation coefficients?

Both Matlab and Excel are reputable software programs and can be trusted to provide accurate results. It is always a good idea to double check your data and calculations to ensure accuracy.

3. Can I manually adjust the correlation coefficient values in Excel to match Matlab's results?

No, it is not recommended to manually adjust the values in Excel to match Matlab's results. This could lead to inaccuracies and compromise the integrity of your analysis.

4. Are there any specific settings I need to adjust in Excel to get the same correlation coefficient results as Matlab?

No, there are no specific settings that need to be adjusted in Excel to get the same results as Matlab. However, it is always a good idea to check the settings and ensure they are consistent between the two programs.

5. Can I use either Matlab or Excel to calculate correlation coefficients in my research?

Yes, both Matlab and Excel can be used to calculate correlation coefficients in research. It is important to choose the software that best fits your needs and to ensure that the results are accurate and consistent.

Back
Top