1
$\begingroup$

In my AP Statistics class, the coverage of Pearson's Correlation Coefficient was pretty limited. It boiled down to "it's a measure of correlation such that $\hat{z_{y}}=rz_{x}$", and he only told us that to emphasize that units don't affect the value of $r$.

Curious, I tried to derive a formula for $r$ using my Calculus knowledge, since all it is is an optimization problem, and he had told us that the goal of regression is to minimize the squared errors of each point. So, these are the steps I took: \begin{align*} \hat{z}_{y}&=rz_{x}\\ r&=\arg\min_{r}\sum_i \left(z_{y_i}-rz_{x_i}\right)^2\\ &=\arg\min_{r}\sum_i\left(z_{y_i}^2-2rz_{y_i}z_{x_i}+r^2z_{x_i}^2\right)\\ &=\arg\min_{r}\sum_i\left(z_{y_i}^2\right)-2r\sum_i\left(z_{y_i}z_{x_i}\right)+r^2\sum_i\left(z_{x_i}^2\right)\\ 0&=\frac{d}{dr}\left[\sum_i\left(z_{y_i}^2\right)-2r\sum_i\left(z_{y_i}z_{x_i}\right)+r^2\sum_i\left(z_{x_i}^2\right)\right]\\ &=2r\sum_i\left(z_{x_i}^2\right)-2\sum_i\left(z_{y_i}z_{x_i}\right)\\ r\sum_i z_{x_i}^2&=\sum_i z_{y_i}z_{x_i}\\ r&=\frac{\sum_iz_{x_i}z_{y_i}}{\sum_iz_{x_i}^2}\\ \end{align*}

But, today, my teacher put the following equation on the board, which seems inconsistent with that: \begin{equation*} r=\frac{\sum_i z_{x_i}z_{y_i}}{n-1} \end{equation*}

Am I wrong, or are these simply formulas that apply in different situations? I'm new to statistics so I could've easily made a faulty assumption somewhere

$\endgroup$
0

1 Answer 1

1
$\begingroup$

I see nothing wrong here. In fact, both formulas are correct. Nice job :) $$r = \frac{\sum_i z_{x_i}z_{y_i}}{\sum_i z_{x_i}^2} = \frac{\sum_i z_{x_i}z_{y_i}}{n-1}$$ Because, $$\sum_i z_{x_i}^2 = \sum_i \left(\frac{x_i - \bar{x}}{s_x}\right)^2 = \frac{\sum_i (x_i - \bar{x})^2}{s_x^2} = \frac{s_x^2(n-1)}{s_x^2} = n-1$$

$\endgroup$
1
  • $\begingroup$ if you define $s_x^2 = \frac1{n-1} \sum\limits _i (x_i-\bar x)^2$ $\endgroup$ Commented Oct 31 at 17:04

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.