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.
use https://stats.idre.ucla.edu/stat/books/sop/tab7pt1.dta, clear svyset [pweight=wt1], fpc(totcnt) svyratio pharmexp/totmedex
Survey ratio estimation pweight: wt1 Number of obs = 7 Strata: <one> Number of strata = 1 PSU: <observations> Number of PSUs = 7 FPC: totcnt Population size = 8 ------------------------------------------------------------------------------ Ratio | Estimate Std. Err. [95% Conf. Interval] Deff ------------------+----------------------------------------------------------- pharmexp/totmedex | .3191489 .0040067 .309345 .3289529 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.
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) svyratio ue91 hou85
Survey ratio estimation pweight: wt Number of obs = 8 Strata: <one> Number of strata = 1 PSU: clu Number of PSUs = 8 FPC: fpc Population size = 32 ------------------------------------------------------------------------------ Ratio | Estimate Std. Err. [95% Conf. Interval] Deff ------------------+----------------------------------------------------------- ue91/hou85 | .1602891 .0055256 .1472232 .173355 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.