2
$\begingroup$

I have seen in a couple of places that the following expression gives the standard error in linear regression:

$$se = \sqrt{\frac{1-r^2}{N-2}}$$

where $r$ is the correlation coefficient. I was calculating this quantity by hand, and by scipy's linregress, and I saw the two numbers differed. I checked the source code, and I found that the expression linregress uses for the standard error is the following:

$$se =\sqrt{\frac{1-r^2}{N-2}\frac{\sum (y_i-\bar{y})^2}{\sum (x_i-\bar{x})^2}}$$

What is the difference between these two expressions? What do they correspond to? How should I interpret them?

Edit: I forgot to specifiy that the data I'm concerned with is bivariate. I.e., I'm fitting a line on ${(x_i,y_i)}$.

Edit 2: I want to calculate the standard error on the correlation coefficient, $r$.

$\endgroup$
  • 1
    $\begingroup$ Welcome to our site! You probably should specify the context you mean - are you specifically interested in simple linear regression ("y on x", the bivariate case) rather than multiple regression? $\endgroup$ – Silverfish May 14 '16 at 0:29
  • $\begingroup$ @Silverfish Thank you :) I meant bivariate, and I edited the post accordingly. $\endgroup$ – sodiumnitrate May 14 '16 at 0:37
  • $\begingroup$ The formula for s.e. in linear regression ? ? There is a formula for s.e. of correlation coefficient which is s.e. of r = (1- r square)/sqr of (n-2). $\endgroup$ – Subhash C. Davar May 14 '16 at 1:45
  • $\begingroup$ 1. What specifically are you computing the standard error of? 2. When you say "bivariate" you mean that the y-variable is a vectore has two components? Or do you mean you have one-DV and one IV (i.e. one y and one x)? $\endgroup$ – Glen_b May 14 '16 at 1:58
  • 1
    $\begingroup$ that is to say, the first equation is the se for r, the second the se for b $\endgroup$ – mandata May 14 '16 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.