UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata FAQ
How do I analyze survey data with a simple random sample 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 53  simple random sampling
use http://www.ats.ucla.edu/stat/books/sop/momsag.dta, clear
svyset [pweight=weight1], fpc(birth)

      pweight: weight1
          VCE: linearized
     Strata 1: <one>
         SU 1: <observations>
        FPC 1: birth

svy: mean momsag
(running mean on estimation sample)

Survey: Mean estimation

Number of strata =       1          Number of obs    =      25
Number of PSUs   =      25          Population size  =     773
                                    Design df        =      24

--------------------------------------------------------------
             |             Linearized
             |       Mean   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
      momsag |        .92   .0544746      .8075699     1.03243
--------------------------------------------------------------
svy: total momsag
(running total on estimation sample)

Survey: Total estimation

Number of strata =       1          Number of obs    =      25
Number of PSUs   =      25          Population size  =     773
                                    Design df        =      24

--------------------------------------------------------------
             |             Linearized
             |      Total   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
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], fpc(fpc)

      pweight: wt
          VCE: linearized
     Strata 1: <one>
         SU 1: <observations>
        FPC 1: fpc

svy: total ue91
(running total on estimation sample)

Survey: Total estimation

Number of strata =       1          Number of obs    =       8
Number of PSUs   =       8          Population size  =      32
                                    Design df        =       7

--------------------------------------------------------------
             |             Linearized
             |      Total   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
        ue91 |      26440   13282.26     -4967.551    57847.55
--------------------------------------------------------------

estat effects

----------------------------------------------------------
             |             Linearized
             |      Total   Std. Err.       Deff      Deft
-------------+--------------------------------------------
        ue91 |      26440   13282.26           1   .866025
----------------------------------------------------------
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 =       1          Number of obs    =       8
Number of PSUs   =       8          Population size  =      32
                                    Design df        =       7

     _ratio_1: ue91/lab91

--------------------------------------------------------------
             |             Linearized
             |      Ratio   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
    _ratio_1 |   .1278159   .0040873      .1181511    .1374808
--------------------------------------------------------------

estat effects

     _ratio_1: ue91/lab91

----------------------------------------------------------
             |             Linearized
             |      Ratio   Std. Err.       Deff      Deft
-------------+--------------------------------------------
    _ratio_1 |   .1278159   .0040873           1   .866025
----------------------------------------------------------
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

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.