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/