[R] Complex Surveys...Specifying Design
Thomas Lumley
tlumley at u.washington.edu
Sat Jul 24 19:39:34 CEST 2004
On Fri, 23 Jul 2004, Tobias Verbeke wrote:
> I guess the most common way of proceeding is to first stratify,
> and then to sample clusters independently within each stratum.
> If this is the case, your data file can be put together like
>
> stratum psu ...
> 1 1
> 1 2
> 1 3
> 2 1
> 2 2
> 2 3
>
> or like
>
> stratum psu ...
> 1 1
> 1 2
> 1 3
> 2 4
> 2 5
> 2 6
>
> svydesign only likes the first data structure so
This is exactly backwards. svydesign by default assumes the *second* data
structure.
>
> meps.design <- svydesign(ids = ~varpsu01, strata = ~varstr01,
> weights = ~perwt01f, nest = TRUE, data = h60)
>
> should work. See ?svydesign.
This fix is correct, even if the rationale is backwards.
-thomas
More information about the R-help
mailing list