Statalist The Stata Listserver

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

st: aweight option in kdensity

From   "vora n" <[email protected]>
To   [email protected]
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)]}
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 ��͹*)
page=features/virus page=features/virus *
* For searches and help try:

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