Statalist The Stata Listserver


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

st: RE: Kdensity and the at option to specify values for estimation


From   "Ben Jann" <ben.jann@soz.gess.ethz.ch>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Kdensity and the at option to specify values for estimation
Date   Sun, 6 Aug 2006 22:38:54 +0200

Try something like

 . kdensity cmeasurem if cohab==0, at(npointsm) gen(x0 d0) nograph
 . kdensity cmeasurem if cohab==1, at(npointsm) gen(x1 d1) nograph
 . twoway line d0 x0, sort || line d1 x1, sort

The -sort- option may be omitted if npointsm is sorted.
ben

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Aimée R. Dechter
> Sent: Saturday, August 05, 2006 11:22 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Kdensity and the at option to specify values for estimation
> 
> Hello,
> 
>  I would be grateful information on whether it is possible to use the at()
> option with two way kdensity or addplot kdensity?
> 
>  I get the error message that option at() is not allowed. However, the
> manual indicates that the at(var) option allows one to more easily obtain
> density estimates for different subsamples of a variable and then overlay
> the estimated densities for comparison.  You can see below that the n()
> command works but the at() command does not, and I checked that the
> variable I created with the points is above the minimum and below the
> maximum of my measure that I would like to plot. I would be grateful for
> confirmation that the a() does not in fact work with these commands or
> that I am making an error of some sort.
> 
> . twoway (kdensity cmeasurem if cohab==0, at(npointsm)) (kdensity
> cmeasurem if
> > cohab==1, at(npointsm))
> option at() not allowed
> invalid syntax
> r(198);
> 
> . twoway (kdensity cmeasurem if cohab==0, n(3000)) (kdensity cmeasurem if
> cohab
> > ==1, n(3000))
> 
> . kdensity cmeasurem if cohab==0, at(npointsm) addplot( kdensity cmeasurem
> if c
> > ohab==1, at(npointsm))
> option at() not allowed
> invalid syntax
> r(198);
> 
> . kdensity cmeasurem if cohab==0, n(3000) addplot( kdensity cmeasurem if
> cohab=
> > =1, n(3000))
> 
> 
> Thank you very much for taking the time to help me with this.
> 
> Aimée Dechter
> 
> 
> *
> *   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/

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index