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 stratified random sampling 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 136 stratified random sampling
use http://www.ats.ucla.edu/stat/books/sop/hospsamp.dta, clear
svyset [pweight=weighta], strata(oblevel) fpc(tothosp)
svytotal births

Survey total estimation

pweight:  weighta                                 Number of obs    =        15
Strata:   oblevel                                 Number of strata =         3
PSU:      <observations>                          Number of PSUs   =        15
FPC:      tothosp                                 Population size  = 157.99993

------------------------------------------------------------------------------
   Total |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
---------+--------------------------------------------------------------------
  births |   183982.9    34014.33      109872    258093.8    .7035474
------------------------------------------------------------------------------
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 births, by (oblevel)

Survey total estimation

pweight:  weighta                                 Number of obs    =        15
Strata:   oblevel                                 Number of strata =         3
PSU:      <observations>                          Number of PSUs   =        15
FPC:      tothosp                                 Population size  = 157.99993

------------------------------------------------------------------------------
Total  Subpop. |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
---------------+--------------------------------------------------------------
births         |
    oblevel==1 |      14931    2669.857    9113.882    20748.12      .15648
    oblevel==2 |   117116.9    33067.66    45068.68    189165.2    1.089405
    oblevel==3 |   51934.98    7508.399    35575.58    68294.37    .0330073
------------------------------------------------------------------------------
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 74 Table 3.3  Estimates from an optimally allocated stratified simple random sample (n = 8); the Province'91 population. 
NOTE:  In this data set, the fpc changes with the strata.  This is different from all of the previous examples.
input id str clu wt ue91 lab91 fpc
1 1 1 1.75 4123 33786 7
2 1 2 1.75 666 6016 7
3 1 4 1.75 760 5919 7
4 1 6 1.75 457 3022 7
5 2 21 6.25 61 573 25
6 2 25 6.25 262 1737 25
7 2 26 6.25 331 2543 25
8 2 27 6.25 98 545 25
end

svyset [pweight=wt], psu(clu) fpc(fpc) strata(str)
svytotal ue91
svyratio ue91 lab91
Survey total estimation

pweight:  wt                                      Number of obs    =         8
Strata:   str                                     Number of strata =         2
PSU:      clu                                     Number of PSUs   =         8
FPC:      fpc                                     Population size  =        32

------------------------------------------------------------------------------
   Total |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
---------+--------------------------------------------------------------------
    ue91 |    15210.5    4279.452    4739.059    25681.94      .20649
------------------------------------------------------------------------------
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.

Survey ratio estimation

pweight:  wt                                      Number of obs    =         8
Strata:   str                                     Number of strata =         2
PSU:      clu                                     Number of PSUs   =         8
FPC:      fpc                                     Population size  =        32

------------------------------------------------------------------------------
      Ratio       |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
------------------+-----------------------------------------------------------
    ue91/lab91    |   .1277788    .0031736    .1200134    .1355442    .3803409
------------------------------------------------------------------------------
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.

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