Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# RE: st: RE: more graphing

 From Nick Cox To "statalist@hsphsun2.harvard.edu" Subject RE: st: RE: more graphing Date Tue, 5 Apr 2011 19:05:37 +0100

```The simplest strategy of all is go back to basics.

1. To put any prediction -- set of predicted values -- on a scatter plot, that prediction needs to be put in a variable. You need to do this immediately after you fit the pertinent model, using -predict-.

2. You can -predict- separately, or you can -separate- predictions. (Couldn't resist.)

3. I tend to use -line- or -mspline- to draw a line (wide sense, including curves).
A key detail here is that using #1 you will get values shown only over the range for that prediction. I see that as a feature. (If you lines drawn over a wider range, you need to use something else, say -twoway function-.)

4. Once you have the variables, you can draw the graphs whenever you want.

I think these principles have all been illustrated in the thread.

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

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Averett, Susan L
Sent: 05 April 2011 18:57
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: RE: more graphing

Thanks again, Nick. I had another related question:
I would like to have three regression lines on the same graph (graphing fitted lahe against age holding female and bachelor constant)

My regressions are:
regress lahe age female bachelor
regress lahe lage female bachelor
gen age2=age*age
regress lahe age2 female bachelor

How can I do this?

Susan Averett
*
*   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/

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