Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Weighted counts with "svy" command


From   Steven Samuels <sjsamuels@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Weighted counts with "svy" command
Date   Wed, 14 Sep 2011 17:04:33 -0400

What would weighted counts look like that are not the population counts? I can't think of any, so please supply an example.


Steve

On Sep 14, 2011, at 10:19 AM, Shige Song wrote:

Dear Colleagues,

We are trying to do an descriptive table of basic socio-demographic
and health characteristics of our 3 subpopulations of interest
(African born, Latin American born, and US born) using the National
Health Interview Survey (NHIS).  (We're using a pooled file,
2005-2009.)  In previous research we would simply use tabulate and
show both the freq and % in our descriptive table.  Now we're using
the "svyset" command and then using "svy: tabulate nativity, count" to
get the weighted counts in the dataset.  However, this command gives
the weighted counts in, apparently, the total population, not in the
dataset.  Do you know how to obtain the weighted counts in the dataset
using "svy"?  I also tried "svy: tabulate nativity, obs", but that
gives us the unweighted number of observations.  Please see the output
below:

Below, for reference, are the unweighted tabulations of our nativity
groups in our 5-year pooled file.
. tab nativity, m
          Nativity |      Freq.     Percent        Cum.
--------------------+-----------------------------------
         U.S. born |    231,546       77.02       77.02
Latin American born |     43,246       14.39       91.41
      African Born |      1,857        0.62       92.02
             Other |     23,982        7.98      100.00
--------------------+-----------------------------------
             Total |    300,631      100.00


And here are the weighted counts when we use the "svy" syntax, but
they are apparently counts in the total population.  We are looking
for weighted frequencies in the dataset.
. svy: tabulate nativity, count format(%14.3gc)
(running tabulate on estimation sample)

Number of strata   =       639                 Number of obs      =     300631
Number of PSUs     =      1278                 Population size    =  222760817
                                              Design df          =        639
-----------------------
Nativity |       count
----------+------------
U,S, bor | 185,258,131
Latin Am |  20,152,746
 African |   1,246,467
   Other |  16,103,473
         |
   Total | 222,760,817
-----------------------
 Key:  count     =  weighted counts

And if we just use "svy: tabulate nativity" (with no option
specified), we get only the cell proportions, although they are
properly weighted.
. svy: tabulate nativity
(running tabulate on estimation sample)

Number of strata   =       639                 Number of obs      =     300631
Number of PSUs     =      1278                 Population size    =  222760817
                                              Design df          =        639

-----------------------
Nativity | proportions
----------+------------
U,S, bor |       .8316
Latin Am |       .0905
 African |       .0056
   Other |       .0723
         |
   Total |           1
-----------------------
 Key:  proportions  =  cell proportions


We tried using "svy: tabulation nativity, obs percent", see below, and
this gives us the weighted percents but the unweighted number of
observations in each category.  We have looked at Stata help for svy:
tabulate, but can't seem to figure this out.  We suspect it's simple.
Does anyone know how to get the weighted counts in the dataset with
svy: tabulate?
. svy: tabulate nativity, obs percent format(%14.3gc)
(running tabulate on estimation sample)

Number of strata   =       639                 Number of obs      =     300631
Number of PSUs     =      1278                 Population size    =  222760817
                                              Design df          =        639

------------------------------------
Nativity | percentages          obs
----------+-------------------------
U,S, bor |        83.2      231,546
Latin Am |        9.05       43,246
 African |         .56        1,857
   Other |        7.23       23,982
         |
   Total |         100      300,631
------------------------------------
 Key:  percentages  =  cell percentages
       obs          =  number of observations

Thanks so much for taking the time to look at this.

Best,
Shige
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index