UCLA Academic Technology Services HomeServicesClassesContactJobs
Help the Stat Consulting Group by giving a gift             
Loading

Stata FAQ
How do I analyze survey data with a simple random sample design?

The examples below use Stata 8.  If you are using Stata version 9, please see this page.

This example is taken from Levy and Lemeshow's Sampling of Populations.

page 53  simple random sampling
use http://www.ats.ucla.edu/stat/books/sop/momsag.dta, clear
svyset [pweight=weight1], fpc(birth)
svymean momsag

Survey mean estimation

pweight:  weight1                                 Number of obs    =        25
Strata:   <one>                                   Number of strata =         1
PSU:      <observations>                          Number of PSUs   =        25
FPC:      birth                                   Population size  =       773

------------------------------------------------------------------------------
    Mean |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
---------+--------------------------------------------------------------------
  momsag |        .92    .0544746    .8075699     1.03243           1
------------------------------------------------------------------------------
Finite population correction (FPC) assumes simple random sampling without 
replacement of PSUs within each stratum with no subsampling within PSUs.
Weights must represent population totals for deff to be correct when
using an FPC.  Note: deft is invariant to the scale of weights.
svytotal momsag

Survey total estimation

pweight:  weight1                                 Number of obs    =        25
Strata:   <one>                                   Number of strata =         1
PSU:      <observations>                          Number of PSUs   =        25
FPC:      birth                                   Population size  =       773

------------------------------------------------------------------------------
   Total |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
---------+--------------------------------------------------------------------
  momsag |     711.16    42.10889    624.2515    798.0685           1
------------------------------------------------------------------------------
Finite population correction (FPC) assumes simple random sampling without 
replacement of PSUs within each stratum with no subsampling within PSUs.
Weights must represent population totals for deff to be correct when
using an FPC.  Note: deft is invariant to the scale of weights.
This example is taken from Lehtonen and Pahkinen's Practical Methods for Design and Analysis of Complex Surveys.
page 29 Table 2.4  Estimates from a simple random sample drawn without replacement (n = 8); the Province'91 population.
input id cluster ue91 lab91
1 1 4123 33786
2 4 760 5919
3 5 721 4930
4 15 142 675
5 18 187 1448
6 26 331 2543
7 30 127 1084
8 31 219 1330
end
gen fpc = 32
gen wt = 4
gen strata = 1
svyset [pweight=wt], psu(cluster)
svytotal ue91
svyratio ue91 lab91
Survey total estimation

pweight:  wt                                      Number of obs    =         8
Strata:   <one>                                   Number of strata =         1
PSU:      cluster                                 Number of PSUs   =         8
                                                  Population size  =        32

------------------------------------------------------------------------------
   Total |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
---------+--------------------------------------------------------------------
    ue91 |      26440    15337.03   -9826.316    62706.32           1
------------------------------------------------------------------------------

Survey ratio estimation

pweight:  wt                                      Number of obs    =         8
Strata:   <one>                                   Number of strata =         1
PSU:      cluster                                 Number of PSUs   =         8
                                                  Population size  =        32

------------------------------------------------------------------------------
      Ratio       |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
------------------+-----------------------------------------------------------
    ue91/lab91    |   .1278159    .0047196    .1166559    .1389759           1
------------------------------------------------------------------------------

How to cite this page

Report an error on this page or leave a comment

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.