On Fri, Jun 6, 2014 at 9:50 AM, Ryan de Vera <ryan.devera.03 at gmail.com>
wrote:> Hello all,
>
> I am trying to understand how svymean is calulated with svydesign.
>
> I have the code:
>
> dstrat1<-svydesign(id=~PSU, strata=~STRATUM,weights=~Sample_Weight,
> data=subset25k, nest=TRUE)
> and I am using svymean to compute the mean.
>
> My main question is how are the sampling probabilities created?
If you supply weights to svydesign(), those weights are used in the
mean calculation. If you supply probabilities, those are used to
compute the weights. If you supply population sizes, those are used
to compute probabilities, which are then used to compute weights.
The code works in terms of probabilities because that's fairly
standard in textbooks. It makes it easier for me to get the formulas
right.
-thomas
--
Thomas Lumley
Professor of Biostatistics
University of Auckland