Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I read from my lecture notes that Pearson correlation can be computed as $\frac{s_{xy}}{s_xs_y}$. If I have been given a finite amount of data points $(x_i,y_i),i=1,\ldots,n$, how can I compute the Pearson correlation using formula $\tfrac{s_{xy}}{s_xs_y}$? I managed to find that $s_{xy}=\dfrac{\sum_{i=1}^n (x_i-\bar{x})(y_i-\bar{y})}{n-1}$ but I didn't found the similar formula for $s_x$ and $s_y$.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

$s_{x}^2=\dfrac{\sum_{i=1}^n (x_i-\bar{x})^2}{n-1}$ = sample variance of the variable $X$.

$s_{y}^2=\dfrac{\sum_{i=1}^n (y_i-\bar{y})^2}{n-1}$ = sample variance of the variable $Y$.

$s_{xy}=\dfrac{\sum_{i=1}^n (x_i-\bar{x})(y_i-\bar{y})}{n-1}$ = sample covariance of the variables $X$ and $Y$.

$s_{x}$ is simply the square root of $s_{x}^2$ and $s_{y}$ is the square root of $s_{y}^2$. They are called the sample standard deviations of $X$ and $Y$ respectively.

share|improve this answer
    
Sorry @BlainWaan s$_x$$_y$ as the OP found it is a sample estimate for the covariance. The other two formulae that address the OPs question are correct. –  Michael Chernick Oct 11 '12 at 17:32
    
@MichaelChernick: Thank you Michael. I didn't notice that I made a mistake, I wrote $s_{xy}^2$ instead of $s_{xy}$ mistakenly! Thank you for correcting me. I should read my answers before posting. I have corrected it. :) –  Blain Waan Oct 11 '12 at 18:11
2  
+1 Note that one can dispense with all the "$n-1$" terms: they will cancel out. For that reason it does not seem very instructive to try to relate these formulas to sample estimates. It is rather more illuminating to rewrite the formula as the average product of the standardized versions of $(x_i)$ and $(y_i)$. –  whuber Oct 11 '12 at 18:17
add comment

It is standard deviation of first and of second variable. See also this example.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.