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

st: RE: by-graph


From   "Steichen, Thomas" <[email protected]>
To   <[email protected]>
Subject   st: RE: by-graph
Date   Fri, 28 Feb 2003 15:33:42 -0500

Itsik Dvir writes:

> I want to make the two changes in the following by-graph command
> 
> twoway (scatter y x ) (lfit y x ) , by(group, total  )
> 
> suppose group contains three subsets of the data.
> 1. eliminate the fitted line in just one individual graph, 
> while still displaying the scatter x-y data.
> 2. change the default title of the total graph ("Total") to say "All" ..
> 
> Can anyone give an advice?

You would need to manually create the parts. The following assumes
groups have numerical values 1, 2 and 3 and group 3 does not need
the fitted line (but is not tested!):

 twoway (scatter y x, if group==1) (lfit y x, if group==1) ///
        (scatter y x, if group==2) (lfit y x, if group==2) ///
        (scatter y x, if group==3)                         ///
        (scatter y x)              (lfit y x)              ///
  legend(label(1 "Group 1 data")   label(2 "Group 1 fit")  ///
         label(3 "Group 2 data")   label(4 "Group 2 fit")  ///
         label(5 "Group 3 data")                           ///
         label(6 "All data")       label(7 "All fit") )

You likely would want to name these better and would have to 
play around with symbol and line colors.  

Tom

-----------------------------------------
CONFIDENTIALITY NOTE:  This e-mail message, including any
attachment(s), contains information that may be confidential,
protected by the attorney-client or other legal privileges, and/or
proprietary non-public information.  If you are not an intended
recipient of this message or an authorized assistant to an intended
recipient, please notify the sender by replying to this message and
then delete it from your system.  Use, dissemination, distribution,
or reproduction of this message and/or any of its attachments (if
any) by unintended recipients is not authorized and may be unlawful.

*
*   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