Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: Several quantile plots in one diagram
From
"Nick Cox" <[email protected]>
To
<[email protected]>
Subject
RE: st: Several quantile plots in one diagram
Date
Wed, 21 Apr 2010 13:52:49 +0100
Barbro is talking about -quantil2-, later renamed -qplot, written by
myself. The searchable documentation makes the line of succession clear,
so I do not know why there is any uncertainty on this point.
. search quantil2
Keyword search
Keywords: quantil2
Search: (1) Official help files, FAQs, Examples, SJs, and
STBs
Search of official help files, FAQs, Examples, SJs, and STBs
SJ-6-4 gr42_4 . . . . . . . . . . . . . . . . . . Software update for
qplot
(help qplot if installed) . . . . . . . . . . . . . . . . . N.
J. Cox
Q4/06 SJ 6(4):597
better handling of x-axis titling, a new option allowing
the user to specify an alternative plotting position or
rank variable
SJ-5-3 gr42_3 . . . . . . . . . . . . . . . . . . Software update for
qplot
(help qplot if installed) . . . . . . . . . . . . . . . . . N.
J. Cox
Q3/05 SJ 5(3):471
simplified syntax; both by() and over() are now allowed
SJ-4-1 gr42_2 Software update for Quantile plots, generalized; renamed
qplot
(help qplot if installed) . . . . . . . . . . . . . . . . . N.
J. Cox
Q1/04 SJ 4(1):97
software update for quantil2, now renamed qplot
STB-61 gr42.1 . . . . . . . Quantile plots, generalized: update to
Stata 7.0
(help quantil2 if installed) . . . . . . . . . . . . . . . N.
J. Cox
5/01 pp.10--11; STB Reprints Vol 10, pp.55--56
updated for use with Stata 7
STB-51 gr42 . . . . . . . . . . . . . . . . . . Quantile plots,
generalized
(help quantil2 if installed) . . . . . . . . . . . . . . . N.
J. Cox
9/99 pp.16--18; STB Reprints Vol 9, pp.113--116
generalizes the quantile command by allowing more than one
variable (or a by() option), more graphical choices, general
plotting positions, and an option to reverse the order
-quantil2- is indeed "pretty old". What's not explicit in this thread is
that it produces the old graphics, for Stata 7 or less. It doesn't crash
my more modern versions of Stata. -qplot- has been available since 2004,
however.
I don't understand how Barbro can install -quantil2- but not -qplot-,
but no matter. I'll email her copies of the -qplot- files.
Maarten is right: you _can_ do this yourself. For related advice in the
same spirit, see
SJ-7-2 gr0027 . . Stata tip 47: Quantile-quantile plots without
programming
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N.
J. Cox
Q2/07 SJ 7(2):275--279 (no
commands)
tip on producing various quantile-quantile (Q-Q) plots
I disagree with Martin about recommending official -quantile- here.
-quantile- can only very awkwardly handle two or more groups; you might
as do it all yourself.
Nick
[email protected]
Widerstedt Barbro
Thank you, that worked very well, but does this mean that the lazy-girl,
no-think option is not available then :) ?
Maarten buis
--- On Wed, 21/4/10, Widerstedt Barbro wrote:
> I have a panel dataset with 6 years, and I would like to
> plot the distribution of a variable in a quantile plot
> for each year in this panel. I have installed quantil2,
> which causes Stata to shut down when I try to save the
> graph. There seems to be upgrades (quantil2 is pretty
> old), but because of firewall restrictions on the remote
> workstation where Stata resides, I can't search or
> install from STATA. I can't find the update qplot or
> other updrage mentioned in e.g. Stata Journal
> 2006(4) on SSC. Where can I find this functionality?
> (I use Stata 10)
You can always recreate the graph from first principle.
In the example below I assume you want to display these
distribution in the same plot. This plot is basically
just a scatter plot. All you need to do is create the
so called "plotting positions", that is, the values on
the x-axis. This is discussed in this Stata FAQ:
<http://www.stata.com/support/faqs/stat/pcrank.html>
In the example below the rep78 variable takes the
place of your year variable.
*-------------- begin example ---------------------
sysuse auto, clear
recode rep78 1/2=3
// create plotting positions
gen byte mis = missing(price,rep78)
bys rep78 mis (price) : gen int i = _n if mis == 0
bys rep78 mis : gen int n = _N if mis == 0
gen hazen = (i - .5) / n
twoway scatter price hazen if rep78 ==3 || ///
scatter price hazen if rep78 ==4 || ///
scatter price hazen if rep78 ==5, ///
legend(order(1 "Average" ///
"or worse" ///
2 "Good" ///
3 "Excellent" )) ///
xtitle("fraction of the data") ///
ytitle("quantiles of price")
*--------------- end example ------------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/