Bookmark and Share

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


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

st: Unexpected output from -collapse (rawsum)


From   "James Beard" <[email protected]>
To   [email protected]
Subject   st: Unexpected output from -collapse (rawsum)
Date   Thu, 26 Sep 2013 12:01:07 -0000

Dear Statalisters,

I'm using 32 bit Stata 11.2 on Windows.

The help for -collapse (rawsum)- says "sums, ignoring optionally 
specified weight". I took this to mean that the result would be the 
same as doing -collapse (sum)- without a weight.

The following example (blank lines removed) shows that this does not 
happen:

. clear all
. set obs 2
obs was 0, now 2
. gen pweight = _n - 1
. gen v = 1
. list, clean
       pweight   v  
  1.         0   1  
  2.         1   1  
. collapse (rawsum) rs=v (sum) ws=v [pw=pweight]
. list, clean
       rs   ws  
  1.    1    1  

I would have expected rs to be 2 (that is, the same as the result of 
unweighted -collapse (sum)-. What appears to be happening is that 
only records with 0<pweight<. are included in the output. Am I 
missing something? Is this the output people would expect? Having 
pweights of 0 (or missing) might be considered strange, but I think I 
can justify that - the 0s are records that should have never been 
sampled, and the missings are records from outside the time period we 
wish to analyse. 

Thanks.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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