Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: svy commands


From   "Nick Winter" <nwinter@policystudies.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: svy commands
Date   Mon, 21 Oct 2002 14:51:23 -0400

This is almost certainly happening because *among cases where
general==0*, there are one or more strata with only one PSU represented.

This is one reason that you want to use -svymean-'s subpop() option,
rather than the -if- qualifier.

Like this:


. svymean x y

Survey mean estimation

pweight:  <none>                                  Number of obs    =
12
Strata:   strat                                   Number of strata =
6
PSU:      psu                                     Number of PSUs   =
12
                                                  Population size  =
12

------------------------------------------------------------------------
------
    Mean |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
---------+--------------------------------------------------------------
------
       x |   .6666667    .1178511    .3782953     .955038       .6875
       y |   .4604045    .0603939     .312626     .608183    .5576608
------------------------------------------------------------------------
------

. svymean y if x==0
stratum with only one PSU detected
r(460);

. gen xzero=(x==0) if x!=.

. svymean y , subpop(xzero)

Note: 3 strata omitted because they contain no subpopulation members

Survey mean estimation

pweight:  <none>                                  Number of obs    =
6
Strata:   strat                                   Number of strata =
3
PSU:      psu                                     Number of PSUs   =
6
Subpop.:  xzero==1                                Population size  =
6

------------------------------------------------------------------------
------
    Mean |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
---------+--------------------------------------------------------------
------
       y |     .49303    .1126696     .134465     .851595     .991555
------------------------------------------------------------------------
------


--Nick Winter


-----------------------------------------------------------
 Nicholas Winter, Ph.D.                     P 202.939.5343
 Policy Studies Associates                  F 202.939.5732
 1718 Connecticut Avenue, NW     nwinter@policystudies.com
 Washington, DC 20009-1148           www.policystudies.com
----------------------------------------------------------- 

> -----Original Message-----
> From: Theodoropoulos, N. [mailto:nt18@leicester.ac.uk] 
> Sent: Monday, October 21, 2002 2:46 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: svy commands
> 
> 
> Dear statalisters,
> 
> I am using the survey commands in Stata to find some means. I 
> have removed all the stratums in which one psu (primary 
> sampling unit) is detected. I check that there is no stratum 
> with one psu for all my variables by using the svydes command. 
> I don't have problems to get the invididual means for the 
> individual variables "general" and "producti". However when i 
> want to find the mean of the "general" variable given that 
> "producti" variable is equal to zero i get the message that a 
> stratum with one psu is detected. The "general" variable is 
> continuous, and the "producti" variable is binary. 
> Any hints will be highly appreciated.
> Thanks in advance.
> 
> Here is a copy of the output that i get.    
> 
>  svymean general
> 
> Survey mean estimation
> 
> pweight:  empwt_nr                                Number of 
> obs    =      1727
> Strata:   newstr1                                 Number of 
> strata =        44
> PSU:      newpsu1                                 Number of 
> PSUs   =       162
>                                                   Population 
> size  = 1200.4609
> 
> --------------------------------------------------------------
> ----------------
>     Mean |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
> ---------+----------------------------------------------------
> ----------------
>  general |   4.156863    .0044976    4.147957     4.16577    2.432631
> --------------------------------------------------------------
> ----------------
> 
> . svymean producti
> 
> Survey mean estimation
> 
> pweight:  empwt_nr                                Number of 
> obs    =      1727
> Strata:   newstr1                                 Number of 
> strata =        44
> PSU:      newpsu1                                 Number of 
> PSUs   =       162
>                                                   Population 
> size  = 1200.4609
> 
> --------------------------------------------------------------
> ----------------
>     Mean |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
> ---------+----------------------------------------------------
> ----------------
> producti |   .3359512    .0475784    .2417331    .4301693    17.51394
> --------------------------------------------------------------
> ----------------
> 
> . svymean general if producti==0
> stratum with only one PSU detected
> r(460);   
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index