On Tue, 30 Oct 2007, Azam, Mehtabul  wrote:

>>> Hi,
>       I am trying to draw a random sample from an household survey with 
> sample weight. Is there any function in R or Splus which allows this.
>

It depends on exactly what you want.

The sample() function will draw unequal probability samples with 
replacement.

sample() will also draw samples without replacement, but (as documented) 
it uses sequential sampling and so does not actually generate 
probabilities proportional to the specified weights for sample sizes 
greater than 1.

The error in sequential sampling is pretty small, but it has attracted a 
lot of creativity in the survey literature (probably more than it 
deserves).  The 'sampling' package implements several algorithms for 
drawing unequal probability samples without replacement that really are 
proportional to the specified weights where this is achievable.

        -thomas

Thomas Lumley                   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]       University of Washington, Seattle

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to