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

st: RE: RE: RE: truncating graph range

From   "Nick Cox" <>
To   <>
Subject   st: RE: RE: RE: truncating graph range
Date   Mon, 31 Oct 2005 11:19:32 -0000

Allan's main advice is to fit a regression line with 
an outlier and to show it on a graph together 
with all the other data. 

That's often a useful technique, but I read 
Timothy's discussion of line plots as wanting
something quite different, namely 

				*     outlier off graph 

                      /    \
                     /      \
                    /        \   lines on graph pointing to it  

I am sure that this is programmable, but I don't know an
easy and general way for a user to do it. 

Likewise Allan's other suggestions do not seem to bear 
on this problem. 


Allan Reese (Cefas)
> Hate to disagree with Nick, but Stata is well-designed for 
> intelligent graph editing.  Timothy maybe needs to fiddle 
> with a few alternatives and work out what would show what he 
> intends.  A log scale is one option but has many other implications.
> For example, it's straightforward in Stata to draw lines 
> with/without outliers.  Other "point'n'click" packages don't 
> make this easy, so suppress the desire.
> fit y x
> predict yhat1
> fit y x if y<1000
> predict yhat2
> scatter y yhat1 yhat2 x if y<1000, connect(. l l) msym(o i i) sort
> Another simple trick is to copy one variable into several, so 
> subsets can be distinguished on the plot.  You could automate 
> this (eg, using egen to save the max value of x), but I'd 
> usually do it as part of visual editing, for example to add 
> text labels to the points at the end of each line. It's 
> therefore feasible to draw a line for the data excluding the 
> outlier, and add a second line in different style pointing up 
> with a label at its end describing the outlier. 
> This is the type of work where I'd draft commands in a DO 
> file so they are easily modified and re-run.
Nick Cox
> What you want is _not_ straightforward. I know no easy and also 
> general way of omitting a data point from a Stata graph and also 
> having it exert some offstage influence on the remainder of 
> the graph. 
> In my experience, when people think they want something like 
> this using a logarithmic scale for the variable concerned is 
> usually the 
> best way forward. 
Timothy Dang
> > I'm making a lot of (line) plots in Stata, and mostly it's working
> > great, but I've hit a snag. For a few of my data sets, 
> there are some
> > data points which are extraordinarily high. With the automatically
> > scaled axis ranges, these points are visible, but all the detail of
> > the rest of the data is shrunk to invisibility.
> > 
> > So, I want to:
> > (a) enforce a maximum for the axis, hopefully showing the 
> lines going
> > up towards some point not shown on the plot, and
> > (b) add some text describing what happens at those points (I can do
> > this outside Stata if needed).
> > 
> > Hopefully this is straightforward and I've just missed something.
> > Thanks for any pointers.

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index