-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CategoricalArrays ("Factor") support as multiple dispatch functions and testing benchmarking #52
Comments
I think this was solved with PR #58, right? |
Yes, some CategoricalArray support has been added for |
I think it would be great to create multiple dispatch from So instead of doing |
Further, need to quantify and benchmark the improvements from grouping by over CategoricalArrays instead of Strings (which would be naive default for a categorical variable). |
julia> apisrs = load_data("apisrs");
julia> srs = SimpleRandomSample(apisrs; weights = :pw);
julia> srs.data.stype = categorical(srs.data.stype);
julia> svymean(:enroll, srs)
1×2 DataFrame
Row │ mean sem
│ Float64 Float64
─────┼──────────────────
1 │ 584.61 27.3684
julia> svymean(:stype, srs)
3×5 DataFrame
Row │ stype counts proportion var se
│ Cat… Int64 Float64 Float64 Float64
─────┼───────────────────────────────────────────────────
1 │ E 142 0.71 0.00100126 0.0316428
2 │ H 25 0.125 0.000531876 0.0230624
3 │ M 33 0.165 0.000669982 0.025884 Also, the standard error for the > library(survey)
> data(api)
> srs <- svydesign(id = ~1, weights = ~pw, data = apistrat)
> svymean(~stype, srs)
mean SE
stypeE 0.71376 0.0291
stypeH 0.12189 0.0177
stypeM 0.16435 0.0229 |
okay ill have a look |
bump |
> srs <- svydesign(id = ~1, data = apistrat, fpc = ~fpc)
> svymean(~stype, srs)
mean SE
stypeE 0.832972 0.0194
stypeH 0.071126 0.0109
stypeM 0.095902 0.0144 > srs <- svydesign(id = ~1, weights = ~pw, data = apistrat, fpc = ~fpc)
> svymean(~stype, srs)
mean SE
stypeE 0.71376 0.0285
stypeH 0.12189 0.0173
stypeM 0.16435 0.0224 These two are also different. From our Julia result and each other. They are also related to #93. It seems like R doesn't derive weights from |
closing as codebase has changed quite a lot |
Add multiple dispatch methods for
CategoricalArray
type columns in the dataset. Behaviour like R does with factor variables.The text was updated successfully, but these errors were encountered: