Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st:-expand- to adjust according to the sampling weight

From   Steven Samuels <[email protected]>
To   [email protected]
Subject   Re: st:-expand- to adjust according to the sampling weight
Date   Mon, 20 Dec 2010 21:59:34 -0500

Ms. Fu, the FAQ ask that you give the source for unofficial software. Kit Baum's -kdens2- does bivariate kernel density plots. I don't know anything about the other commands you referred to. Try the the example in the -help- for -kdens2-, first as written, then as expanded 100 times. ("expand 100") The two graphs will be very different: expansion doesn't work. The command you were looking for was "expand weight". As you say, expansion is equivalent to the use of frequency weights. The absence of frequency weight support in -kdens2- is not an accident. Apparently there is no way to incorporate weights into a - kdens2- analysis.

Steven Samuels

[email protected]
18 Cantine's Island
Saugerties NY 12477
Voice: 845-246-0774
Fax:    206-202-4783

On Dec 20, 2010, at 9:11 PM, Amanda Fu wrote:

Dear Mr. Samuels,

Sorry for not making my question clear. I will keep in mind to provide
plenty of details in the future.

Here is my response to the questions you listed: The command is
-kdens2- , -spkde-,-spmap-. They allow neither frequency weights nor
sampling weights. The data structure is unbalanced panel data.There
are no clusters and strata. Simply only the sampling weight for each
individual exists. The purpose of my study is to estimate the
bivariate kernel density.

I thought I could expand the data based on sampling weights before
using those commands. I thought I could treat sampling weight similar
as frequency weight when expanding the data set:

.expand sweight

Even if this command is appropriate, it has a problem: the average
value for sampling weight in the data set is close to 3000. The
expanded data set would be too huge. Thus I was thinking to expand
with a smaller number, say

. sum sweight
. g new_weight=sweight/r(mean)
. expand new_weight

This way a number of observations will just remain unchanged after
expanding. I am not sure if this makes sense.

Thanks for your time!
*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index