Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: problem of stratum with only one PSU


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: problem of stratum with only one PSU
Date   Sun, 25 Nov 2007 16:06:17 -0500

Deepankar Basu <[email protected]>:
I think the FAQ you cite advocates collapsing strata, not dropping obs.
You can adapt the code at
http://www.stata.com/statalist/archive/2007-11/msg00810.html
to collapse strata with single PSUs into one larger stratum, something
like this:

qui reg alive sxch [pw=weight]
g ok=e(sample)
bys ok strat (psu): g single=psu[1]==psu[_N] if ok
egen newpsu=group(strat psu)
g newstr=cond(single==1,-1,strat)
svyset newpsu [pw=weight], str(newstr)

An even more straightforward approach is to ignore strata in all
analyses (collapse all strata into one):

egen newpsu=group(strat psu)
svyset newpsu [pw=weight]


On Nov 25, 2007 2:07 PM, Deepankar Basu <[email protected]> wrote:
> I am working with Stata 8. While testing for the equality of means with
> survey data using:
>
> .svymean alive, by(sxch)
>
> I run up against the very common problem of several strata with
> singleton PSUs. As suggested in the Stata FAQ
> (http://www.stata.com/support/faqs/stat/stratum.html), I can deal with
> this problem by:
>
> .svydes alive
> (to identify the strata with singleton PSUs; for example let us say that
> strata 10 has a single PSU)
>
> . list strata psu if strata==10
> (to identify the corresponding observations; say the observations are
> 110 to 154)
>
> . drop in 110/154
>
> I am working with data from several countries (about 70) and I want to
> avoid doing this manually for all the countries; doing this manually
> would take me several days. Can somebody suggest how to write a do file
> that reads the dataset for each country and:
> (a) identifies all the strata with singleton PSUs;
> (b) identifies the corresponding observations (for the above strata) and
> drops those observations.
>
> Deepankar
>
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index