Ben,
Again, Thank you very much for you help :)
I have looked at your paper and have just
tried the kdens module (very powerful!).
I actually have another question that I would
like to clarify (please correct me).
----------------------
If I do:
[1]
.kdensity income
Then the default kernal is Epanechnikov
and the default bandwidth is the "optimal"
bandwidth (silverman).
----------------------
If I do:
[2]
.kdens income
Then the default kernal is Epan2
and the default bandwidth is silverman.
[In your paper, equation 28 and equation 29
are actually the same thing?]
----------------------
So if I want kdens to provide the same graph
as the default kdensity then I should do:
[3]
.kdens income, k(e)
----------------------
However, it seems like the graph from [1] and [3]
are not the same. Am I missing something?
Thank you very much.
Best regards,
Vora
From: "Ben Jann" <[email protected]>
Reply-To: [email protected]
To: <[email protected]>
Subject: st: RE: aweight option in kdensity
Date: Wed, 13 Sep 2006 10:06:55 +0200
The formula is
f(x) = {1/(h*W} {sigma [wi * K((x - xi)/h)]}
where wi are the weights (inverse of sampling probability
if the weights are sampling weights) and W is the sum of
weights over all observarions and
. kdensity income [aw=MY_W]
will give you the correct estimate.
ben
Also see:
- http://fmwww.bc.edu/RePEc/bocode/k/kdens.pdf.
- Buskirk and Lohr (2005). Asymptotic properties of kernel
density estimation with complex survey data. Journal
of Statistical Planning and Inference 128: 165 - 190.
Vora N wrote:
> I have problem understanding the aweight option
> in kdensity command and the manual (and everywhere
> else I have read) is not helping. Please help?
> Also, please correct me if my understanding is wrong.
>
> Basically, if I have a survey data of people's income
> in a country. Let's say I have n observation in
> my data and each observation has its own weight
> (sampling weight -- I believe it's called probability
> weight in stata?). These weights will sum to the country's
> population. This weight variable is named MY_w.
> (sum of MY_w over all the n observations equals to the
> country's population)
>
> Now, I want to estimate the density of their income.
>
> --------------------
> if I do:
>
> >kdensity income
>
> Then, I don't take into account of those sampling
> weights. The formula is:
>
> [equation 1]
> f(x) = {1/nh} {sigma[(K(x - xi)/h)]}
>
> h--bandwidth
> n--sample size
> K--kernal function
> xi--each observation's income
> sigma--summation i = 1 to n
>
> So I assume that each observation is sampled at equal
> probability of 1/n -- which is wrong?
>
> --------------------
> I think the weight I have is pweight but kdensity
> doesn't allow pweight. It only allows fweight and
> aweight. It seems like fweight is out of the question.
>
> I should be doing this?
>
> [equation 2]
> f(x) = {1/h} {sigma [wi * K((x - xi)/h)]}
>
> where wi is the probability of that observation being
> sampled (so wi was 1/n in [equation 1])
>
> Now, I wonder if kdensity with aweight can give me
> the estimate of [equation 2]
>
> Should I be doing this?
>
> >kdensity income [aw=MY_W]
>
> or should I be doing this?
>
> >kdensity income [aw=1/MY_W]
>
> or I shouldn't use aweight and try to edit the command
> by my owen? Would the unweighted version be wrong?
*
* 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/
_________________________________________________________________
MSN 8 ��ͧ�ѹ����������� (��� 2 ��*) http://join.msn.com/?page=features/virus
*
* 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/