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
"Widerstedt Barbro" <[email protected]>
To
<[email protected]>
Subject
RE: st: Several quantile plots in one diagram
Date
Wed, 21 Apr 2010 14:11:01 +0200
Thank you, that worked very well, but does this mean that the lazy-girl,
no-think option is not available then :) ?
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Maarten buis
Sent: den 21 april 2010 11:49
To: [email protected]
Subject: Re: st: Several quantile plots in one diagram
--- 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 )
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/
*
* 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/