Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Alfonso S <oneiros_spain@yahoo.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: How to plot cdf after corrected kernel density |
Date | Thu, 3 Oct 2013 15:20:15 -0700 (PDT) |
Hi, I suggest you download the package akdensity (st0037_3). It does an adaptive kernel density and generates the cdf variable as well. Use the code below to check it out. sysuse auto akdensity mpg, g(a b) cdf(cb) line cb a Let me know if that is what you were looking for. Alfonso ----- Original Message ----- From: Nick Cox <njcoxstata@gmail.com> To: "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> Cc: Sent: Thursday, October 3, 2013 6:01 PM Subject: Re: st: How to plot cdf after corrected kernel density The bottom line in the post you cite advises "I prefer to get smoother cumulative distribution functions directly from estimated quantiles." I agree with that. Nick njcoxstata@gmail.com On 3 October 2013 21:45, Jain, Monica (HarvestPlus) <M.Jain@cgiar.org> wrote: > I am using -kdens- and I do not know how to plot the cumulative distribution function. I am using Stata 13 for Windows. > > I am using -kdens- to estimate kernel density correcting for bounded variables using linear combination method. I want to plot the cumulative distribution function for the estimated kernel densities. On one of the statlist threads (http://www.stata.com/statalist/archive/2005-04/msg00798.html), the following method has been suggested to plot them: > > sysuse auto > _kdens mpg, g(b a) > cumul b, g(cb) > line cb b, sort > > With the above command, I get the densities on the x-axis, rather than the [x]. I looked all over the web to check if I can find how to do it, but I have not been successful. If I use the following command: > > line cb a, sort > > I get weird triangle shaped graph. > > Monica Jain > Postdoctoral Fellow > HarvestPlus, IFPRI > > > > * > * 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/ * * 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/ * * 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/