Re: [R] Survey proportions... Can I use population as denominator?

From: Thomas Lumley <>
Date: Thu 25 May 2006 - 06:37:52 EST

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 Lumley			Assoc. Professor, Biostatistics	University of Washington, Seattle

______________________________________________ mailing list PLEASE do read the posting guide! Received on Thu May 25 07:54:32 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 25 May 2006 - 10:10:20 EST.

Mailing list information is available at Please read the posting guide before posting to the list.