Bookmark and Share

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: more graphing

From   Nick Cox <>
To   "" <>
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. 


-----Original Message-----
From: [] On Behalf Of Averett, Susan L
Sent: 05 April 2011 18:57
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:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index