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

st: -sliceplot- and -cquantile- available on SSC

From   "Nick Cox" <>
To   <>
Subject   st: -sliceplot- and -cquantile- available on SSC
Date   Wed, 2 Nov 2005 15:01:38 -0000

Thanks to Kit Baum, new -sliceplot- 
and -cquantile- programs are now 
downloadable from SSC. 

sliceplot: time series or other plot in slices

Often a time series plot -- or indeed some other 
kinds of plot -- would benefit from a short and 
wide scale. In his excellent books on graphics, 
Bill Cleveland recommends as an ideal that line 
segments should be close to 45 deg. This advice 
is also to be found as far back as R.A. Fisher's 
"Statistical methods for research workers", and 
perhaps earlier. 

This rule is difficult to achieve on the kind of 
time series that goes up and down like a demented
yo-yo on steroids, unless either you have easy 
access to a printer with special paper sizes 
or you slice the plot and then recombine in 
one image. I can do nothing about your printer
access but I provide in -sliceplot- ways of 
cutting up the original data by sections of 
the horizontal axis variable (e.g. time)
into component graphs, then putting them together 
again by -graph combine-, thus reducing the 
nitty-gritty somewhat. 

Even if it is not what you want in this 
territory, some of the code in -sliceplot- 
may be suitable for your own programs. 

Stata 8 is required for the ado and 
Stata 9 is required for the help file. 
Thus Stata 8 users should find this works; 
it is just that the on-line help will 
show some SMCL directives that Stata 8 doesn't 

cquantile: corresponding quantiles

As a fan of quantile-quantile plots, I make 
much use of Stata's -qqplot-, but aside from the 
excellent graphics features of Stata >=8, I note that
it lacks some of the statistical features that might be 

Thus -qqplot- does not directly support 
the q-q plotting of two groups of the same variable. 
This is soluble by -generate-ing two variables, one 
for each group, just before the -qqplot-. [R] 
diagnostic plots gives an example. -separate- may 
be used more efficiently to the same end. 

More importantly, -qqplot- often suggests structure 
that one would like to show or examine in other ways. 
Thus if one set of quantiles differs from another 
mostly by an additive shift -- or possibly by 
a multiplicative one -- then such structure can be 
examined by looking at the difference between 
corresponding quantiles versus their mean, or the 
ratio of the corresponding quantiles versus their 
geometric mean. 

To get such results, there are various strategies
including (a) pestering StataCorp to extend the 
command and (b) cloning -qqplot-, getting inside
and adding code. In this case, following the 
"less is more" philosophy, I just took the part 
of -qqplot- that calculates the quantiles and 
added a -generate- option. Then you can plot, 
or otherwise manipulate, the quantiles as desired. 

Thus -cquantile- generates corresponding quantiles, namely, those 
quantiles that would be shown on a quantile-quantile plot. 
Given either two numeric variables, or one numeric variable and 
one grouping variable defining two groups, two new variables 
are generated containing the quantiles.  

Stata 9 is required. 


*   For searches and help try:

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