Statalist The Stata Listserver


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

st: aweight option in kdensity


From   "vora n" <vora_stata@hotmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: aweight option in kdensity
Date   Tue, 12 Sep 2006 13:12:28 -0700

Dear all,

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?

Thank you very much.

Best regards,

Vora N

_________________________________________________________________
MSN 8 ป้องกันไวรัสในอีเมล (ฟรี 2 เดือน*) http://join.msn.com/?
page=features/virus 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/




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