Error bar on slopes of linear regression

For a specific project I needed to determine a parameter from the slope on a line based on inputs and output ($$Y = mX + b;$$ sorry, can't get too specific). To estimate the error on that parameter, I did some google searches and found the following

$$errorbar_{m} = m \times t_{\alpha/2} \times \sqrt{ \dfrac{\dfrac{1}{r.sq} -1 }{n - 2}}$$

$$m = m_{estimate} \pm errorbar_m$$

with $$t_{\alpha/2}$$ being the appropriate t parameter, r.sq the Pearson correlation coefficient r squared, and n-2 the degrees of freedom based on number of data points.

Of course, I forgot where I found this and later I needed this again. I only found the textbook expressions based on

$$m = m_{estimate} \pm t_{\alpha/2}\,\dfrac{s}{ \sqrt{S_{xx}}}.$$

Question 1. Where does the formula involving 1/r.sq - 1come from? Is it even valid?

Question 2. Does anyone have a reference to the formula?

• It is difficult to give any credence to your first formula, because when $m=0$ it gives no error, which obviously is wrong. Why not look up the formula so you can get it right? That would likely clarify things for you and, even if not, will lead to simpler answers.
– whuber
Sep 14 at 19:17
• I completely agree with your assessment at m = 0, but I did some recalculation on my data where m <> 0 and came out with this:  err.bar err.bar.regular <dbl> <dbl> 1 3.09 3.09 2 8.06 8.06 3 0.954 0.954 4 0.374 0.374  (bad formatting, but numbers are equal) Sep 14 at 19:46