onlinetwodcorrelation:   Correlation coefficient of a discrete joint probability distribution P(x,y)


Formulas

P(x|y) = P(x,y)/P(y)

P(y|x) = P(x,y)/P(x)

s2x = Σ(x-x̄)2f(x)

s2y = Σ(y-ȳ)2f(y)

sx,y = Σ(x-x̄)(y-ȳ)f(x,y)

rx,y = sx,y/(sxsy)

Reference


INPUT DATA:

Enter size of square array n (number n of x equal to number n of y; separate each value with a comma):     

4

Enter n Px(j) values (in any consistent units; separate each value with a comma):
[Px (j, k) = Py (j, k) ]:

100,200,300,400

Enter n2 Px,y(j,k) values (j varying first, k varying second; separate each value with a comma)
[The sum of Px,y (j, k) values should equal 1]:

0.14,0.03,0.00,0.00,0.02,0.18,0.11,0.00,0.00,0.09,0.23,0.02,0.00,0.00,0.03,0.15


OUTPUT:

Variance sx = 95.263

Variance sy = 87.422

Covariance sx,y = 7785

Correlation coefficient rx,y = 0.839


Thank you for running onlinetwodcorrelation.   Please call again.   [151030]

Count