xKDR / Survey.jl

Analysis of complex surveys
https://xkdr.github.io/Survey.jl/
GNU General Public License v3.0
53 stars 19 forks source link

When passing both weights and popsize #314

Open ayushpatnaikgit opened 1 year ago

ayushpatnaikgit commented 1 year ago
julia> dclus1 = SurveyDesign(apiclus1; weights=:pw, clusters=:dnum, popsize=:fpc)
SurveyDesign:
data: 183×45 DataFrame
strata: none
cluster: dnum
    [637, 637, 637  …  448]
popsize: [757, 757, 757  …  757]
sampsize: [15, 15, 15  …  15]
weights: [50.4667, 50.4667, 50.4667  …  50.4667]
allprobs: [0.0198, 0.0198, 0.0198  …  0.0198]
> dclus1 = svydesign(id=~dnum, data = apiclus1, weight = ~pw, fpc = ~fpc)

> dclus1$allprob

            pw
1   0.02954472
2   0.02954472
3   0.02954472
4   0.02954472
5   0.02954472
6   0.02954472
7   0.02954472
8   0.02954472
9   0.02954472
...

Notice the difference in allprobs

We are prefering popsize, while R prefers weights.