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

Problems with deriving one variable from the other #313

Closed ayushpatnaikgit closed 1 year ago

ayushpatnaikgit commented 1 year ago

Don't think this is correct https://github.com/xKDR/Survey.jl/blob/735613ee1450c2cfe7731d7739db9a08a829c2e6/src/SurveyDesign.jl#L85

For example, in dclus1, it says the sample size is 15, but it's actually 183, the number of rows. Clustering doesn't affect the sample size, only stratification does. I think we should have the else condition.

@smishr

ayushpatnaikgit commented 1 year ago

Not entirely sure actually

ayushpatnaikgit commented 1 year ago
> dclus1 = svydesign(id=~dnum, data = apiclus1, fpc = ~fpc)

> dclus1$allprob

           fpc
1   0.01981506
2   0.01981506
3   0.01981506
4   0.01981506
5   0.01981506
6   0.01981506
7   0.01981506
...

> dclus2 = svydesign(id=~dnum, data = apiclus1, weight = ~pw)

> dclus2$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
...