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

Stata FAQ
How can I do regression estimation with survey data?

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

This example is taken from Lehtonen and Pahkinen's Practical Methods for Design and Analysis of Complex Surveys.

This example provides the numbers necessary to use the formula in the middle of page 106.  The svyreg is run to get the coefficient of hou85 and the svytotal is run to get the estimated total of hou85.  These numbers are used in the formula and the result (15312) is shown in the last line of Table 3.14 on page 107.
input id str clu wt ue91 hou85 gwt adjwt smplrat
1 1 1 4 4123 26881 .5562 2.2248 .25
2 1 4 4 760 4896 .5562 2.2248 .25
3 1 5 4 721 3730 .5562 2.2248 .25
4 1 15 4 142 556 .5562 2.2248 .25
5 1 18 4 187 1463 .5562 2.2248 .25
6 1 26 4 331 1946 .5562 2.2248 .25
7 1 30 4 127 834 .5562 2.2248 .25
8 1 31 4 219 932 .5562 2.2248 .25
end
gen fpc = 32
svyset [pweight=wt], fpc(fpc) psu(clu)
svyreg ue91 hou85
Survey linear regression

pweight:  wt                                      Number of obs    =         8
Strata:   <one>                                   Number of strata =         1
PSU:      clu                                     Number of PSUs   =         8
FPC:      fpc                                     Population size  =        32
                                                  F(   1,      7)  =  44949.18
                                                  Prob > F         =    0.0000
                                                  R-squared        =    0.9982

------------------------------------------------------------------------------
        ue91 |      Coef.    Std. Err.      t    P>|t|    [95% Conf. Interval]
-------------+----------------------------------------------------------------
       hou85 |   .1520142     .000717   212.01   0.000    .1503188    .1537097
       _cons |   42.65468    20.54033     2.08   0.076   -5.915492    91.22485
------------------------------------------------------------------------------
Finite population correction (FPC) assumes simple random sampling without 
replacement of PSUs within each stratum with no subsampling within PSUs.
svytotal hou85

Survey total estimation

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

------------------------------------------------------------------------------
   Total |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
---------+--------------------------------------------------------------------
   hou85 |     164952    87298.57   -41476.32    371380.3           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.

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.