I have my own implementation of the covariance function based on the equation:

''' Calculate the covariance coefficient between two variables. ''' import numpy as np X = np.array([171, 184, 210, 198, 166, 167]) Y = np.array([78, 77, 98, 110, 80, 69])
But the problem is that I get different values ββfrom my function and from numpy.cov() , numpy.cov() .:
My function: [[ 273.88888889 190.61111111] [ 190.61111111 197.88888889]] Numpy.cov() function: [[ 328.66666667 228.73333333] [ 228.73333333 237.46666667]]
Why? How is the numpy.cov() function implemented? If the numpy.cov() function is well implemented, what am I doing wrong? I will simply say that the results of my covariance() function are consistent with the results from paper examples on the Internet for calculating the covariance coefficient, for example http://www.naukowiec.org/wzory/statystyka/kowariancja_11.html .
python numpy scipy
bluevoxel
source share