Bookmark and Share

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]

st: Univariate distribution graphs in a twoway environment?


From   <Stefan.Gawrich@hlpug.hessen.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Univariate distribution graphs in a twoway environment?
Date   Tue, 8 Oct 2013 07:48:22 +0200

Interesting idea, Phil.
I think that it will work for me.
Thank you very much!

Stefan



How is something like this? You can use -kdensity- to generate variables that form the basis of a graph.

----------------------------------------------------------
clear
set obs 5
gen group=_n
expand 100
gen x=rnormal(group, 0.5)
forvalues i=1/5 {
	kdensity x if group==`i', gen(k_`i'_x k_`i'_d) nograph
	replace k_`i'_d=k_`i'_d + `i' - 0.5
	local line `line' line k_`i'_d k_`i'_x ||
}
twoway `line', ylab(1/5) ytitle(Group) legend(off)
----------------------------------------------------------

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index