Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: twoway scatter plot -- how to show the regression equation in the legend
From
[email protected]
To
"[email protected]" <[email protected]>
Subject
Re: st: twoway scatter plot -- how to show the regression equation in the legend
Date
Tue, 17 Sep 2013 18:20:03 +0100
see also -aaplot- from SSC.
Nick
[email protected]
On 17 Sep 2013, at 09:30, Maarten Buis <[email protected]> wrote:
> On Tue, Sep 17, 2013 at 9:56 AM, Alice Guerra wrote:
>> I was wondering if it is possible to compute and show in the legend
>> the regression line in a twoway scatter plot with lfit.
>
> *------------------ begin example ------------------
> sysuse auto
> reg price mpg
> local eq "`e(depvar)' ="
> local eq "`eq' `: display %7.0g _b[_cons]'"
> local eq "`eq' `=cond(_b[mpg] > 0, "+", "-")'"
> local eq "`eq' `: display %5.0g abs(_b[mpg])' mpg"
>
> twoway lfit price mpg || ///
> scatter price mpg, ///
> legend(order(1 2 - "`eq'"))
> *------------------- end example -------------------
> * (For more on examples I sent to the Statalist see:
> * http://www.maartenbuis.nl/example_faq )
>
> Hope this helps,
> Maarten
>
> ---------------------------------
> Maarten L. Buis
> WZB
> Reichpietschufer 50
> 10785 Berlin
> Germany
>
> http://www.maartenbuis.nl
> ---------------------------------
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/