Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Linear regression, correlation coefficient and Stat 8 Graphs


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Linear regression, correlation coefficient and Stat 8 Graphs
Date   Fri, 30 Apr 2004 15:26:24 +0100

It is often simplest just to run -correlate- and then 
put a suitably rounded result in some title. 

However, the following shows how this could be 
automated more: 

. sysuse auto 
. gen gpm = 1 / mpg 
. corr gpm weight 
. local corr : di %5.3g r(rho) 
. twoway lfit gpm weight || scatter gpm weight , subtitle("correlation `corr'") 

Nick 
[email protected] 

Oliver Morgan
> 
> I have produced a twoway scatter plot to which I have fitted a linear
> prediction plot using the lfit option in Stata 8.
> 
> However, I would also like to present the correlation 
> coefficient (r) on
> this graph.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index