[R] Survey package
Thomas Lumley
tlumley at u.washington.edu
Mon Sep 10 17:41:45 CEST 2007
On Thu, 6 Sep 2007, eugen pircalabelu wrote:
> Good afternoon!
>
> I'm trying to use the Survey package for a stratified sample which has
> 4 criteria on which the stratification is based. I would like to get the
> corrected weights and for every element i get a weight of 1
>
> E.g: tipping
>
> design <- svydesign (id=~1, strata= ~regiune + size_loc + age_rec_hhh
> + size_hh, data= tabel)
> and then weights(design)
> gives me: 1,1,1,1,1,1,1,1,1,1,1,........... for each element
>
There are two problems. The first is that you have the wrong syntax for
strata. If you have one stage of sampling with multiple stratifying
factors you need to create a single factor representing the strata. One
way is with interaction()
design <- svydesign (id=~1, strata= ~interaction(regiune, size_loc, age_rec_hhh, size_hh), data= tabel)
Second, you have not specified either weights or population sizes, so R
has no way to work out the sampling weights. That's why you get weights of
1. You should also get a warning.
-thomas
More information about the R-help
mailing list