# What is $s_x$ in Pearson correlation?

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$.

## 2 Answers

$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.

• 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
• +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

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