## Karl Pearson’s Correlation Coefficient

Let `$(x_i, y_i), i=1,2, \cdots , n$`

be $n$ pairs of observations.

## Formula

The Karl Pearson’s coefficient of correlation between two variables $X$ and $Y$ is denoted by $r_{xy}$ or $r$ and is given by

`$r_{xy} = \dfrac{Cov(X,Y)}{\sqrt{Var(X) Var(Y)}}=\dfrac{s_{xy}}{s_x\cdot s_y}$`

where,

- the sample covariance between $x$ and $y$ is

```
$$
\begin{aligned}
Cov(x,y) =s_{xy}&=\frac{1}{n-1}\sum_{i=1}^{n}(x_i -\overline{x})(y_i-\overline{y})\\
&= \frac{1}{n-1}\bigg(\sum_{i=1}^n x_iy_i - \frac{(\sum_{i=1}^n x_i)(\sum_{i=1}^n y_i)}{n}\bigg)
\end{aligned}
$$
```

- the sample variance of $x$ is

```
$$
\begin{aligned}
V(x) =s_{x}^2 &=\frac{1}{n-1}\sum_{i=1}^{n}(x_i -\overline{x})^2\\
&= \frac{1}{n-1}\bigg(\sum_{i=1}^n x_i^2 - \frac{(\sum_{i=1}^n x_i)^2}{n}\bigg)
\end{aligned}
$$
```

- the sample variance of $y$ is

```
$$
\begin{aligned}
V(y) =s_{y}^2 &=\frac{1}{n-1}\sum_{i=1}^{n}(y_i -\overline{y})^2\\
&= \frac{1}{n-1}\bigg(\sum_{i=1}^n y_i^2 - \frac{(\sum_{i=1}^n y_i)^2}{n}\bigg)
\end{aligned}
$$
```

- the sample mean of $x$ is

```
$$
\begin{aligned}
\overline{x}&=\frac{1}{n}\sum_{i=1}^n x_i
\end{aligned}
$$
```

- the sample mean of $y$ is

```
$$
\begin{aligned}
\overline{y}&=\frac{1}{n}\sum_{i=1}^n y_i
\end{aligned}
$$
```

## Related Resources

Suggestions and comments will be appreciated.