Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Stas Kolenikov <skolenik@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: SVY medians and Elixhauser |
Date | Mon, 15 Apr 2013 09:49:52 -0500 |
I think there was something still wrong with the -subpop()- option the first time you tried it: the size of the subpopulation coincided with the size of the population as perceived by Stata. This sounds fishy, and probably was due to your use of pvt variable. What happens if you move it to the -if- condition? I am somewhat uneasy about mixing the dummy variable coding of -subpop- vs -if- coding of -subpop-, and tend to use the latter, so that I am explicit about what's going on. If your -pvt- variable has missing values, then God only knows how that subpop will actually be shaped up by Stata. -- Stas Kolenikov, PhD, PStat (SSC) -- Senior Survey Statistician, Abt SRBI -- Opinions stated in this email are mine only, and do not reflect the position of my employer -- http://stas.kolenikov.name On Mon, Apr 15, 2013 at 12:11 AM, Mike Butterfield <mcbutterfield@gmail.com> wrote: > Hi Steve (thanks for the reference) and Stas- I had some trouble with > epctile and wanted to get your opinion on whether this is ‘legal’ > (legitimate) to do. > > > 1. I tried to get median ages for my patients with portal vein > thrombosis (pvt) for both those with& without cirrhosis, but I had > some strata with single observations. > > 2. I identified the strata and excluded them (~6 observations), and > got it to work. > > 3. Is ok to do? Output for non cirrhotics is below. > > a. This didn’t work: > > . epctile AGE, p(50) over(cirr) svy speclab subpop(pvt if AGE>=18 & AGE<=90) > > (running mean on estimation sample) > > Survey: Mean estimation > > Number of strata = 53 Number of obs = 3665 > > Number of PSUs = 482 Population size = 18356 > > Subpop. no. obs = 3665 > > Subpop. size = 18356 > > Design df = 429 > > > > 0: cirr = 0 > > 1: cirr = 1 > > > > -------------------------------------------------------------- > > | Linearized > > Over | Mean Std. Err. [95% Conf. Interval] > > -------------+------------------------------------------------ > > __000006 | > > 0 | -.0236348 . . . > > 1 | -.0477322 . . . > > -------------------------------------------------------------- > > Note: missing standard errors because of stratum with single > > sampling unit. > > estimates post: matrix has missing values > > r(504); > > > > > > b. this did: > > > > svydes AGE if AGE>=18 & AGE<90 & pvt==1 & cirr==0 > > > > Survey: Describing stage 1 sampling units > > > > pweight: DISCWT > > VCE: linearized > > Single unit: missing > > Strata 1: NIS_STRATUM > > SU 1: HOSPID > > FPC 1: <zero> > > > > #Obs with #Obs with #Obs per included Unit > > #Units #Units complete missing ---------------------------- > > Stratum included omitted data data min mean max > > -------- -------- -------- -------- -------- -------- -------- -------- > > 2111 1* 0 1 0 1 1.0 1 > > 2412 1* 0 1 0 1 1.0 1 > > 3111 1* 0 1 0 1 1.0 1 > > 3112 1* 0 1 0 1 1.0 1 > > 3121 1* 0 1 0 1 1.0 1 > > 4112 1* 0 1 0 1 1.0 1 > > 4122 1* 0 4 0 4 4.0 4 > > -------- -------- -------- -------- -------- -------- -------- -------- > > 51 399 0 1495 0 1 3.7 69 > > ------------------ > > . epctile AGE, p(50) svy speclab subpop(pvt if AGE>=18 & AGE<=90 & > cirr==0 & NIS_STRATUM ~=2111 & NIS_STRATUM ~=2412 & NIS_STRATUM ~=3111 > & NIS_STRATUM ~=3112 & NIS_STRATUM ~=3121 & NIS_STRATUM ~=4112) > > > > Number of strata = 44 Number of obs = 1492 > > Number of PSUs = 394 Population size = 7486.8 > > Subpop. no. obs = 1492 > > Subpop. size = 7486.8 > > Design df = 350 > > > ... > > > Percentile estimation > > ------------------------------------------------------------------------------ > > | Linearized > > AGE | Coef. Std. Err. z P>|z| [95% Conf. Interval] > > -------------+---------------------------------------------------------------- > > p50 | 56 .75 74.67 0.000 54.53003 57.46997 > > > > Mike > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/