Survey.jl icon indicating copy to clipboard operation
Survey.jl copied to clipboard

When passing both weights and popsize

Open ayushpatnaikgit opened this issue 1 year ago • 0 comments

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.

ayushpatnaikgit avatar Aug 17 '23 12:08 ayushpatnaikgit