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 9.  If you are using Stata versions 7 or 8, please see this page.

NOTE:  If you want to see the design effect or the misspecification effect, use estat effects after the command.

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)

      pweight: weighta
          VCE: linearized
     Strata 1: oblevel
         SU 1: <observations>
        FPC 1: tothosp

svy: total births
(running total on estimation sample)

Survey: Total estimation

Number of strata =       3          Number of obs    =      15
Number of PSUs   =      15          Population size  =     158
                                    Design df        =      12

--------------------------------------------------------------
             |             Linearized
             |      Total   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
      births |   183982.9   34014.33        109872    258093.8
--------------------------------------------------------------
svy: total births, over(oblevel)
(running total on estimation sample)

Survey: Total estimation

Number of strata =       3          Number of obs    =      15
Number of PSUs   =      15          Population size  =     158
                                    Design df        =      12

            1: oblevel = 1
            2: oblevel = 2
            3: oblevel = 3

--------------------------------------------------------------
             |             Linearized
        Over |      Total   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
births       |
           1 |      14931   2669.857      9113.882    20748.12
           2 |   117116.9   33067.66      45068.68    189165.2
           3 |   51934.98   7508.399      35575.58    68294.37
--------------------------------------------------------------
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 clu [pweight=wt], fpc(fpc) strata(str)

      pweight: wt
          VCE: linearized
     Strata 1: str
         SU 1: clu
        FPC 1: fpc

svy: total ue91
(running total on estimation sample)

Survey: Total estimation

Number of strata =       2          Number of obs    =       8
Number of PSUs   =       8          Population size  =      32
                                    Design df        =       6

--------------------------------------------------------------
             |             Linearized
             |      Total   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
        ue91 |    15210.5   4279.452      4739.059    25681.94
--------------------------------------------------------------

estat effects

----------------------------------------------------------
             |             Linearized
             |      Total   Std. Err.       Deff      Deft
-------------+--------------------------------------------
        ue91 |    15210.5   4279.452      .20649   .393532
----------------------------------------------------------
Note: Weights must represent population totals for deff to be correct when using an FPC; however, deft is
      invariant to the scale of weights.

svy: ratio ue91 lab91
(running ratio on estimation sample)

Survey: Ratio estimation

Number of strata =       2          Number of obs    =       8
Number of PSUs   =       8          Population size  =      32
                                    Design df        =       6

     _ratio_1: ue91/lab91

--------------------------------------------------------------
             |             Linearized
             |      Ratio   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
    _ratio_1 |   .1277788   .0031736      .1200134    .1355442
--------------------------------------------------------------

estat effects

     _ratio_1: ue91/lab91

----------------------------------------------------------
             |             Linearized
             |      Ratio   Std. Err.       Deff      Deft
-------------+--------------------------------------------
    _ratio_1 |   .1277788   .0031736     .380341   .534093
----------------------------------------------------------
Note: Weights must represent population totals for deff to be correct when using an FPC; however, 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