How to Calculate the Pearson Correlation coefficient between the bits of a 20 bit hash value?

210 views (last 30 days)
I am working on testing the uniformity of the hash functions.For that i need to find how uniformaly the bits were distributed in the 20 bit hash value.
There are examples to find the correlation coefficient between two values X and Y. I don't know how to calculate the correlation between the bits of a hash value.
The hash value will be like hash= 29600128950574211287.
Thanks,
Elakkiya

Answers (2)

Saurav Chaudhary
Saurav Chaudhary on 29 Oct 2020
Go through the following documentation link to find about " corrcoef ", which can be used to calculate Pearson Correlation Coefficient.

fiza
fiza on 19 Oct 2024
n=input("enter the number of observations");
sumx=0;
sumy=0;
sumxx=0;
sumyy=0;
sumxy=0;
for k=1:n
x(k)=fprintf("enter the value of x(%d)":k);
x(k)=input("enter the value of x(%d)":k);
y(k)=fprintf*("enter the value of y(%d)"):k);
y(k)=input("enter the value of x(%d)":k);
sumx=sumx+x(k);
sumy=sumy+y(k);
sumxy=sumxy+(x(k)*y(k));
sumxx=sumxx+(x(k)*x(k));
sumyy=sumyy+(y(k)*y(k));
end
kp=((n*sumxy)-sumx*sumy)/(sqrt((n*sumxx)-(sumx*sumx)))*(sqrt((n*sumyy)-(sumy*sumy)))
disp=("kp");

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!