David L. Van Brunt, Ph.D.
2006-May-23 22:24 UTC
[R] Survey proportions... Can I use population as denominator?
Just giving the survey package a spin... I'm accustomed to stata, and it seems very similar in many respects. One thing is throwing me, however. I've gotten my data in, and specified the design. Looks like the weighting is right (based on published population estimates from these data), but now I'd like to check my "marginal means" for proportions against those that have been published. I'd think that "svyratio" would do the trick, but one needs to specify both the numerator and the denominator... I'm looking for a simple ratio of males to females, and this is eluding me. I can't just use a "1" as the denominator, and I want the whole population described as two values that add to one. The help screens have not been fruitful so far. I'm suffering from interference, I'm sure, where knowledge of another package is getting in the way of seeing what I need to do. Anyone able to nudge me in the right direction? Much obliged... -- --------------------------------------- David L. Van Brunt, Ph.D. mailto:dlvanbrunt@gmail.com [[alternative HTML version deleted]]
Thomas Lumley
2006-May-24 20:37 UTC
[R] Survey proportions... Can I use population as denominator?
On Tue, 23 May 2006, David L. Van Brunt, Ph.D. wrote:> Just giving the survey package a spin... > > I'm accustomed to stata, and it seems very similar in many respects. One > thing is throwing me, however. > > I've gotten my data in, and specified the design. Looks like the weighting > is right (based on published population estimates from these data), but now > I'd like to check my "marginal means" for proportions against those that > have been published.No, actually you get means with svymean(). Proportions for factor levels come by svymean() with a factor variable, eg:> data(api) > dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc) > svymean(~stype,dclus1)mean SE stypeE 0.786885 0.0463 stypeH 0.076503 0.0268 stypeM 0.136612 0.0296> svymean(~sch.wide,dclus1)mean SE sch.wideNo 0.12568 0.0204 sch.wideYes 0.87432 0.0204 -thomas Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle