Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Adding markers to kernel density plot line


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Adding markers to kernel density plot line
Date   Mon, 19 Feb 2007 11:02:21 +0000 (GMT)

--- Johanna Vogel wrote:
> but how would this be applied with "twoway kdensity", the command 
> for plotting the kernel density (as far as I understand, this uses 
> -graph twoway line- only in the background - it is not entered 
> directly into the command line).

You can ask -kedensity- to save the variables, and then use those.
See the example below:

*---------- begin example ----------------
sysuse auto, clear
kdensity price, gen(x y) at(price) nograph
twoway line y x, sort || /*
    */ scatter y x, msymbol(+) name(plus, replace) legend(off)


* I actually like a rug plot underneath the smooth better:

gen y1 = 0
gen y2 = .00001
twoway line y x, sort || /*
    */ pcspike y1 price y2 price , legend(off)
*------------- end example ----------------

Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------




		
___________________________________________________________ 
Copy addresses and emails from any email account to Yahoo! Mail - quick, easy and free. http://uk.docs.yahoo.com/trueswitch2.html
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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