# st: RE: Linear regression; where is the correlation coefficient

 From "Nick Cox" To Subject st: RE: Linear regression; where is the correlation coefficient Date Mon, 11 Aug 2008 18:02:45 +0100

```I guess that you are concerned here (mostly, at least) with regression
with a single predictor, say y = a + bx.

The expectation is indeed that if you want the correlation r = corr(x,
y) then you can get it from -correlate- or from sqrt(e(r2)).

program myr
version 8
di sqrt(e(r2))
end

makes that just about as painless as possible, unless (I doubt it)
StataCorp changes their mind on this point.

I don't use Excel and in case have to guess at what you mean by "the
graph". Perhaps you want -twoway lfit y x- to display an equation.
-sparl- on SSC shows an equation but it is written for Stata 6 and will
not use the new graphics. I know that the author regards it as a dead
program, but there is code within to display the equation.

On confidence intervals for correlations, there is more than one way to
do it.
John Gleason in 1996 published this, which works fine.

STB-32  sg51  . . .  Inference about correlations using the Fisher
z-transform
(help z_r, z_rci, z_rcopy, z_rplt, z_rvrfy) . . . . . .  J. R.
Gleason
7/96    pp.13--18; STB Reprints Vol 6, pp.121--128
commands for statistical inference about correlation
coefficients
via the Fisher z-transform

Both programs and the STB write-up are accessible to all.

Bootstrapping is another possibility but it's important to note that
confidence limits for any interesting correlation will be asymmetric
given the constraints of [-1,1].

Nick
n.j.cox@durham.ac.uk

Carlo Georges

It is rather straight forward to do a linear regression, but i ckecked
lots
of options but coul not find the r, deriving it from R(square) is a bit
tedious.
Is there a way to include the regession equation, in the graph as with
Excel.

Is it possible to print the confidence interval for a correlation
coefficient

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```