Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: converting non-integer weights into integer weights


From   "Stephen P Jenkins" <[email protected]>
To   <[email protected]>
Subject   RE: st: converting non-integer weights into integer weights
Date   Thu, 20 Nov 2003 09:50:01 -0000

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> Ramani Gunatilaka
> Sent: 20 November 2003 09:32
> To: [email protected]
> Subject: RE: st: converting non-integer weights into integer weights
> 
> 
> Stephen,
> Thanks so much for the feedback. 
> I didn't think of using aweights because they are defined as 
> being inversely proportional to the variance of an 
> observation. The weights in my data represent the total 
> number of households in the entire population that each 
> particular household represents - probably derived as some 
> fraction of the entire population. 
> The two are not equivalent, are they?
> That's why I thought of using fweights. I was following 
> Kieran's suggestion when I got your mail. I'd appreciate your 
> comments on this, if it is not too much trouble. Ramani

Regardless of how aweights are sometimes motivated, and how your weights
are motivated, you've ended with a variable that is the weight that you
want to use and it is non-integer. Using the aweight option is simply a
means of doing your calculations.  (Where the different assumptions
about what underlies the weights really matters typically affects the
calculation of the sampling variances associated with the statistics of
interest rather than the point estimates, and it is the latter that you
seek)


Stephen
-------------------------------------------------------------
Professor Stephen P. Jenkins <[email protected]>
Institute for Social and Economic Research
University of Essex, Colchester CO4 3SQ, U.K.
Tel: +44 1206 873374.  Fax: +44 1206 873151.
http://www.iser.essex.ac.uk   


> 
> Stephen P Jenkins <[email protected]> wrote:
> > Why do you need to convert the weights to integers?  The 
> -_pctile- and
> > -kdensity- commands accept aweights, and aweights can be 
> non-integer?
> > 
> > 
> > Stephen
> > 
> > > > -----Original Message-----
> > > > From: [email protected]
> > > > [mailto:[email protected]]On Behalf Of Ramani
> > > > Gunatilaka
> > > > Sent: Thursday, 20 November 2003 10:42 AM
> > > > To: [email protected]
> > > > Subject: Re: st: converting non-integer weights into 
> integer weights
> > > >
> > > >
> > > > Hi all,
> > > > I am sorry to bug you with this problem again but the solution 
> > > > that
> > > > Branko very kindly suggested didn't work for me. To recap 
> > > briefly, I
> > > > need to use weights with the  _pctile and kdensity
> > > commands. But mine
> > > > are non-integer weights (for an example see my first mail
> > > below) and
> > > > even though I multiplied the weights by 100 as Branko
> > > suggested (since
> > > > they have only two decimal places) I get an error as follows:
> > > >
> > > >  use c:\data95\hhcons95, clear
> > > >
> > > > . keep x hhsize w
> > > >
> > > > . gen freq=hhsize*w*100
> > > >
> > > > . _pctile x [fweight=freq],
> > > > percentiles(5,10,15,20,25,30,35,40,45,50,55,60,65,7
> > > > > 0,75,80,85,90,95,99)
> > > >
> > > > may not use noninteger frequency weights
> > > > r(401);
> > > >
> > > > I have a hunch that multiplying the original weight by 100
> > > made it too
> > > > long to be stored as an integer. The largest transformed
> > > weight then
> > > > becomes 7 digits.
> > > >
> > > > Would anybody have any ideas on this?
> > > >
> > > > Thanks so much,
> > > > Ramani
> > > >
> > > >
> > > >
> > > > [email protected] wrote:
> > > > >       Ramani,
> > > > >
> > > > > why don;t you multiply the weights by a hundred (or 
> whatever; a
> > > > > thousand), and then create integers. kdensity should  
> work then.
> > > > >
> > > > >       best, branko
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >    IMPORTANTISSIMO!!!
> > > > >    From around October 15, 2003 my new
> > > > >    Email address will be
> > > > >    [email protected]
> > > > >
> > > > >
> > > > >    ALL ABOUT INEQUALITY IN THE WORLD (AND MORE!)
> > > > >    http://www.worldbank.org/research/inequality/
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Ramani Gunatilaka
> > > > > <[email protected] To:
> > > > > ash.edu.au> [email protected]
> > > > > Sent by: cc:
> > > > > [email protected] Subject: st: Use of Weights
> > > in Kernel
> > > > > Density Estimation ard.edu
> > > > >
> > > > >
> > > > > 11/16/2003 09:11 AM
> > > > > Please respond to statalist
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Hi all,
> > > > > I hope there maybe someone out there who may be able 
> to help me
> > > > with this
> > > > > query.
> > > > > I have a household level data set of roughly 19,000
> > > households with
> > > > > the following variables: per capita consumption in rupees (x),
> > > > > population weights
> > > > > (w) and household size (hhsize) as in the sample 
> below (I'm sorry 
> > > > > the column heads are not aligned).
> > > > >
> > > > > x            w           hhsize
> > > > > 204.4059           176.45            3
> > > > > 402.0174           119.22            6
> > > > > 218.7155           51.84             8
> > > > > 1083.199           1266.73           6
> > > > > 303.6877           169.54            3
> > > > >
> > > > > The weights represent the number of households in the entire
> > > > > population that each particular household represents.
> > > > >
> > > > > I need to estimate the kernel density of the consumption
> > > > distribution and
> > > > > have
> > > > > consulted Stata's kdensity function as well as the
> > > akdensity module
> > > > > developed by Van Kerm. Both permit the use of weights,
> > > but only of
> > > > > fweights and aweights. But
> > > > > while the weights in my data set are frequency 
> weights, they are 
> > > > > certainly not integers as required by Stata.
> > > > >
> > > > > Would someone know how I may get round this problem? I'd
> > > rather use
> > > > > the kdensity or akdensity commands and not have to write up a
> > > > > programme from scratch.
> > > > >
> > > > > Thanks so much,
> > > > > Ramani
> > > > > *
> > > > > *   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/
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > *
> > > > > *   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/
> > > > *
> > > > *   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/
> > > >
> > > >
> > > 
> > > 
> > > *
> > > *   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/
> > > 
> > 
> > *
> > *   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/
> *
> *   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/
> 

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index