Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: kdensity with few (/aggregated) data points

From   Amy <>
Subject   st: kdensity with few (/aggregated) data points
Date   Wed, 30 Jun 2010 08:23:11 -0700 (PDT)


I just thought to re-phrase my question. I've noticed that if I have very few data points (e.g. 10) then kdensity gives me something jagged even if I specify a Gaussian kernel (regardless of the bandwidth). If the reason I have so few data points is because I have aggregate data, e.g. data for each decile of a population, is there any way to make this smoother? Why is it that histogram X, bin(10) kdensity kdenopts(gauss) will give me something that looks smoother?

Thank you.

--- On Sat, 6/26/10, Amy <> wrote:

> From: Amy <>
> Subject: kdensity with binned data
> To:
> Date: Saturday, June 26, 2010, 3:45 AM
> Hi,
> I have aggregate data for each decile of a population. When
> I try to 
> plot the kernel density estimator (for sake of reference,
> you can define
>  variable "test" to be 10, 20, 40, 50, 60, 70, 80, 90, 95,
> 99 and then 
> try 
> kdensity test, kernel(gauss) 
> with various bandwidths), its peaks at each of the values
> are pointed 
> rather than smooth. Yet if I try 
> histogram test, bin(10) kdensity kdenopts(gauss) 
> the density will appear much smoother, even for the same
> bandwidth and 
> kernel. Comparing the results with R's "density(test, 
> kernel=c("gaussian"), weights=NULL, window=kernel, n=100)",
> R's density 
> also looks smooth (Stata's "kdensity test, kernel(gauss)"
> won't let me 
> specify n(100) since the number of binned datapoints I have
> is 10). 
> Ultimately I would like to use those 10 binned data points
> to plot the 
> density across the whole population and sample from it so
> that I can 
> infer some values for the person at the 26th percentile,
> the 27th 
> percentile, etc.
> Can Stata handle binned data like this?
> Thank you.


*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index