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

st: RE: Graphic question V8: graphing adjusted values with CI


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Graphic question V8: graphing adjusted values with CI
Date   Mon, 3 Mar 2003 10:51:07 -0000

Moran, John
> 
> Exploring the new graphics (tentatively) in V8 (running SE, 
> updated to 30
> Jan exec, 25 Feb ado), I am trying to plot a fairly basic 
> function, adjusted
> values, of a regression, but am having trouble doing it all 
> via the graphic
> GUI. So:
> 
> regress  price mpg weight displacement
> adjust  weight displacement, by( mpg) se gen(abc def)
> gen  def_l=abc-1.96* def
> gen de_u=abc+1.96* def
> 
> I then try to plot the predicted values, upper and lower CI 
> using the GUI; I
> get to this without tooo much trouble:
> 
> twoway (scatter price mpg, msymbol(none)) (scatter abc mpg, 
> msymbol(diamond)
> msize(small)) ///
> (line def_l mpg, sort clpat(dash) clwidth(medthin)) ///
> (line de_u mpg, sort clpat(dash) clwidth(medthin)) 
> 
> But I still have to draw the solid line of the linear 
> predictor through the
> diamond symbols; so back to the command line:
> 
> twoway (scatter price mpg, msymbol(none)) (scatter abc mpg, 
> msymbol(diamond)
> msize(small)) ///
> (line def_l mpg, sort clpat(dash) clwidth(medthin)) ///
> (line de_u mpg, sort clpat(dash) clwidth(medthin)) ///
> (line abc mpg, sort clpat(solid) clwidth(medium)) 
> 
> Now it all comes out nicely in the end (at least on my 
> machine!!), but the
> limitation to 4 overlays seems frustrating for a basic 
> function such as
> plotting the adjusted means of a regression. Now there is 
> "regpred" plus
> other functions by J. Garrett in V7, but the graphics are 
> obviously not V8
> quality. 
> 
> Have I missed something initially in the set up of the 
> initial plots such
> that this can all be done in 4 overlays? Cannot seem to do 
> it at this end,
> but.............

The three calls to -line- can be reduced to one.

More generally, what you want is presumably programmable 
as a wrapper for a call to -adjust- and a call to -graph-. 
There is always a design question of when such a wrapper 
becomes too complicated to be worth it. For a start, the programmer 
has to inflict upon you, the user, a syntax allowing 
you to specify -adjust- arguments, -scatter- options 
and -line- options. Whatever, it appears that no one has 
done it yet. 

Nick 
n.j.cox@durham.ac.uk 
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index