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

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


From   "Moran, John (NWAHS)" <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: RE: Graphic question V8: graphing adjusted values with CI
Date   Tue, 4 Mar 2003 11:25:00 +1030

Thanks to Nick Cox for responding to my question regarding graphing adjusted
means. 

In the mean time, I will plough on as it were.

However, if I may follow Nick's comment about  "The three calls to -line-
can be reduced to one."
Being new to the syntax of V8 graphics, I used the GUI to plot the graph
with the "submit" option and then copied the command to a do file for
subsequent manipulation, as was suggested in previous postings in this list.

This manoeuvre, via the GUI, lead to the multiple lines of code for what I
considered to be a reasonably basic task in statistics, at least in my
practice; the visual display of the functional form of predictors in a
multivariable regression. I do not know about other members of the list, but
the occasions that I would wish to display, in V8 graphic format (that is
_publishable_ graphic), a univariate regression would be few, to say the
least. 

Given the enormous overhead of V8 graphics (from my perspective,
syntactical, as I prefer code to GUI), two questions seem to follow: 
(i) is the GUI teaching us sub optimally with respect to the code that it
leaves in its wake?
(ii) should the graphics of V8(+) be more attuned to what has already
occurred in V7 with streg and now, in V8 with stcox, the exploration of
multivariable relations (that is, the graphic display of adjusted
estimates). It seems that one cannot do graphically, within current Stata,
for "regression" (logistic or linear) what one can more easily do, with
stcox and streg.

John moran

Nick Cox [mailto:[email protected]] 
Sent: Monday, March 03, 2003 9:21 PM
To: [email protected]
Subject: st: RE: Graphic question V8: graphing adjusted values with CI


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 
[email protected] 
*
*   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/
*
*   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