Correlation

Input






Formulas and Output

\[\bar{x} = 428.9\] \[\bar{y} = 103\] \[var(x) = 15498.98889\] \[var(y) = 14.88889\] \[COV_{xy} = \frac{\sum (x-\bar{x})(y- \bar{y})}{(n-1)}=\frac{\sum xy - n\times\bar{x}\times\bar{y}}{(n-1)}\] \[COV_{xy} = \frac{\ (439271 - 10 \times 428.9 \times 103) }{( 10 -1)} = -277.33333\] \[COR_{xy} = \frac{COV_{xy}}{\sqrt{var(x)\times var(y)}} = \frac{ -277.33333 }{\sqrt{ 15498.98889 \times 14.88889 }} = -0.57732\]

What is Correlation?

In statistics, correlation is any statistical relationship between two random variables or bivariate data. In other words it measures the degree to which two variables move in relation to each other.

The formula used to calculate correlation asssumes the variables are normally distributed. If the variables are not normally distributed you may want to use a spearman rank order correlation instead which can be found under the non parametric tests.

The correlation coefficient must have a value that is between -1 and 1.
• Correlation coefficient of -1 means a negative relationship, in other words the two variables always move in an opposite direction.
• Correlation coefficient of 0 means no relationship at all between the two variables, in other words they are independent of each other.
• Correlation coefficient of 1 means a positive relationship, in other words the two variables always move in the same direction.

Example, Bob just got a degree in business administration and got hired as a security analyst for the "prestigious" Deutsche Bank. His boss Christian Sewing gave him the task to find the correlation between the stock price of BP and the price of oil.

Wise man Bob decided to take a sample from the last 10 trading days of BP and oil price to see if there is a meaningful correlation and got the following data:
BP stock price = [575 571 570 575 304 320 340 344 340 350]
Oil price = [100 103 102 98 112 105 103 100 105 102]

Bob calculated the correlation coefficient and got a correlation of -0.577, which means according to Bobs study that BP has a negative correlation with oil price. Without questioning if his results are logical he sends the report to Christian Sewing.