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

Re: st: Re: Weighted number of observations


From   Toyoto Iwata <[email protected]>
To   [email protected]
Subject   Re: st: Re: Weighted number of observations
Date   Tue, 03 Aug 2004 16:29:11 +0900

Dear Friedrich Huebler

You wrote about

> . tabstat foreign [aw=weight], stat(sum)
>
> variable | sum
> -------------+----------
> foreign | 50950
> ------------------------

Perhaps I miss the point, but,

.gen eachmean = foreign*weight

.gen sumeachmean = sum(eachmean)  /* I don't know the mean of this. */

. list sumeachmean in l

     +----------+
     | sumeac~n |
     |----------|
 74. |    50950 |
     +----------+

This seems to agree with the definition of the aweight.

[Online help says,]

aweights, or analytic weights, are weights that are inversely 
proportional to the variance of an observation; i.e., 
the variance of the j-th observation is assumed to be sigma^2/w_j, 
where w_j are the weights.  
Typically, the observations represent averages and the weights are 
the number of elements that gave rise to the average.  


> The Stata User's Guide states in section 14.1.6: "For most Stata
> commands, the recorded scale of aweights is irrelevant; Stata
> internally rescales them to sum to N, the number of observations in
> your data, when it uses them." It would be useful if the Stata
> documentation could make clear which commands don't use aweights in
> this manner.
> 
> Friedrich Huebler

sincerely,

Toyoto

*
*   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