Skip to content
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

Design update #133

Merged
merged 334 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
334 commits
Select commit Hold shift + click to select a range
e93ae7a
Shikhar manual testing code
smishr Sep 30, 2022
5360700
changed clean examples
smishr Sep 30, 2022
1bfdfa9
Merge pull request #58 from smishr/design_update
smishr Sep 30, 2022
d25f884
Change ... to reduce.
sayantikaSSG Oct 7, 2022
d1bf631
Merge pull request #61 from sayantikaSSG/design_update
ayushpatnaikgit Oct 8, 2022
9c68108
Remove duplicate code and comments and rephrase error messages for SRS
iuliadmtru Oct 8, 2022
6458bfa
Remove duplicate code and comments and rephrase error messages for St…
iuliadmtru Oct 9, 2022
ebfc090
Remove duplicate code and comments and add TODO comments
iuliadmtru Oct 15, 2022
f934c37
Generalize `show` method for all `AbstractSurveyDesign` subtypes
iuliadmtru Oct 15, 2022
7f5a271
Change description of helper function and move `show` method to the top
iuliadmtru Oct 15, 2022
6a0df4b
Remove unnecessary comment
iuliadmtru Oct 15, 2022
63edd63
Remove comments and format code
iuliadmtru Oct 15, 2022
8cff71a
Add TODO comment inside function body, not inside docstring
iuliadmtru Oct 15, 2022
d8ee896
Remove unnecessary comment
iuliadmtru Oct 15, 2022
b726657
Remove unnecessary comments and format code
iuliadmtru Oct 15, 2022
1254224
Remove comments and error case for not passing `q` parameter
iuliadmtru Oct 15, 2022
c32c543
Remove and rephrase comments and docstrings
iuliadmtru Oct 15, 2022
8b02ab6
Remove comments
iuliadmtru Oct 15, 2022
e24da83
Remove and rephrase comments
iuliadmtru Oct 15, 2022
fbe9f00
Remove and rephrase comments
iuliadmtru Oct 15, 2022
1d12f7d
Remove comments
iuliadmtru Oct 15, 2022
466cc35
Remove and rephrase comments
iuliadmtru Oct 15, 2022
21d784d
Remove comments
iuliadmtru Oct 15, 2022
2b4f4a6
Remove and rephrase comments
iuliadmtru Oct 15, 2022
44079c6
Remove and rephrase comments
iuliadmtru Oct 15, 2022
86d139d
Implement new function for nice printing and move `show` to a separat…
iuliadmtru Oct 15, 2022
ffea267
Merge pull request #63 from iuliadmtru/minor_corrections
ayushpatnaikgit Oct 16, 2022
e2a35b6
Merge pull request #65 from xKDR/main
iuliadmtru Oct 17, 2022
6151336
Merge branch 'xKDR:main' into docs_improve
iuliadmtru Oct 17, 2022
0a110cd
Pull and integrate changes from `design_update` and `main`
iuliadmtru Oct 17, 2022
5668157
Merge branch 'docs_improve' of github.com:iuliadmtru/Survey.jl into d…
iuliadmtru Oct 17, 2022
b330c34
Update SurveyDesign class, parse Non-cluster designs
smishr Oct 20, 2022
7c24497
Add SurveyDesign struct and fns to export
smishr Oct 20, 2022
a3db52e
Display options for SurveyDesign
smishr Oct 20, 2022
dc2b4be
Horvitz Thomp correct means, HR variance
smishr Oct 20, 2022
0dc0d6e
Added comments on testing
smishr Oct 20, 2022
c1b32ab
Add poststratification and sampling templates
smishr Oct 21, 2022
4c31b8b
Reorder cluster parsing
smishr Oct 21, 2022
0af0e78
Merge branch 'xKDR:design_update' into design_update
smishr Oct 21, 2022
98f7f01
Merge branch 'design_update' of https://github.com/smishr/Survey.jl i…
smishr Oct 21, 2022
c587f6e
Git commit issue
smishr Oct 21, 2022
5c92904
Fix err sampsize>popsize, Add C;usterSample class
smishr Oct 21, 2022
590dbe8
Remove test line 24
smishr Oct 21, 2022
61a9e5c
Add svyratio estimator
smishr Oct 21, 2022
c14c088
Add strat test2, line 121
smishr Oct 21, 2022
406eb4a
Rephrase and reorder docstrings
iuliadmtru Oct 23, 2022
96cfd2f
Correct `show` for `svydesign` and move it to the show.jl file
iuliadmtru Oct 26, 2022
48c3851
Include show.jl after svydesign.jl
iuliadmtru Oct 26, 2022
40685c7
Correct doctests
iuliadmtru Oct 26, 2022
123fb60
Add SRS tests
sayantikaSSG Oct 28, 2022
32f4860
Add Svymean tests
sayantikaSSG Oct 28, 2022
ace6bbe
Add check for invalid probs weights args
smishr Oct 31, 2022
ba00f81
Add SurveyDesign test cases SRS
smishr Oct 31, 2022
277b45e
Implement `svytotal` for `svyby`
iuliadmtru Oct 31, 2022
082e4fa
Implement `svymean` for `svyby` matching R
iuliadmtru Oct 31, 2022
4c5d5e7
Rename `GeneralSample` back to `ClusterSample`
iuliadmtru Oct 31, 2022
3f52fc5
Correct the path for doc image
iuliadmtru Oct 31, 2022
93c686c
Rephrase and remove outdated documentation
iuliadmtru Oct 31, 2022
f2f0042
Merge pull request #54 from iuliadmtru/docs_improve
ayushpatnaikgit Nov 1, 2022
40791c4
Merge branch 'design_update' into design_update
iuliadmtru Nov 1, 2022
bc6b242
Merge pull request #69 from iuliadmtru/design_update
ayushpatnaikgit Nov 1, 2022
437393d
Merge branch 'xKDR:design_update' into design_update
sayantikaSSG Nov 2, 2022
12b9132
Merge pull request #68 from sayantikaSSG/design_update
sayantikaSSG Nov 2, 2022
a280859
Revert "Added Tests and found bugs to be fixed in src/"
iuliadmtru Nov 3, 2022
9664336
Merge pull request #74 from xKDR/revert-68-design_update
iuliadmtru Nov 4, 2022
612c832
Correct doctest
iuliadmtru Nov 4, 2022
fe2227d
Run doctest checks only for exported functions
iuliadmtru Nov 4, 2022
a9070e1
Remove unnecessary docstrings
iuliadmtru Nov 4, 2022
42a0aae
Include API for all exported functionality
iuliadmtru Nov 4, 2022
d81e922
Reorder index and API
iuliadmtru Nov 4, 2022
5b072f2
Merge pull request #76 from iuliadmtru/doctest_correction
smishr Nov 4, 2022
22d1f24
Merge branch 'design_update' of github.com:iuliadmtru/Survey.jl into …
iuliadmtru Nov 4, 2022
0c8b988
Revert "Add check for invalid probs weights args"
smishr Nov 5, 2022
ee93e5d
Remove @show in SimpleRandomSample
smishr Nov 5, 2022
cb69bfd
Remove clean_examples file
smishr Nov 5, 2022
dfc26ed
tried fixing git merge in show.jl
smishr Nov 5, 2022
555a5b3
Merge branch 'design_update' into design_update
smishr Nov 5, 2022
35212a1
Merge pull request #66 from smishr/design_update
smishr Nov 5, 2022
ae642e9
Cleaned ht_svymean
smishr Nov 5, 2022
669ea7b
Updated intro
smishr Nov 6, 2022
d9eddb6
Merge pull request #77 from iuliadmtru/doctests_corrections
iuliadmtru Nov 7, 2022
109ad2f
Merge pull request #79 from xKDR/78-readme-needs-to-be-updated
smishr Nov 7, 2022
945acd4
Add svyby testing template
smishr Nov 10, 2022
ea941da
Add draft inner method svyby svymean, dimension error
smishr Nov 10, 2022
a34aa52
Merge branch 'xKDR:design_update' into design_update
smishr Nov 10, 2022
e60507b
Changed svyby svymean working
smishr Nov 11, 2022
3a99366
remove comments spaces
smishr Nov 14, 2022
0a929c3
Add variance of domain mean working
smishr Nov 14, 2022
ec9c5ee
Merge pull request #1 from smishr/domain_stratified_sample_sem_svyby
smishr Nov 14, 2022
0a33c2d
Merge branch 'design_update' into domain_stratified_sample
smishr Nov 14, 2022
e9e90bd
Make `svymean` output consistent for `CategoricalArray`
iuliadmtru Nov 14, 2022
2428f88
Make `svytotal` output consistent for `CategoricalArray`
iuliadmtru Nov 14, 2022
81e09bf
Minor changes from review
smishr Nov 15, 2022
576d8f0
Merge branch 'domain_stratified_sample' into domain_stratified_sample…
smishr Nov 15, 2022
4ab8db2
Merge pull request #2 from smishr/domain_stratified_sample_sem_svyby
smishr Nov 15, 2022
0d7aa10
Remove underscore sem_svyby
smishr Nov 15, 2022
c895099
Merge pull request #84 from smishr/domain_stratified_sample
smishr Nov 15, 2022
93bb6f5
testing of SurveyDesign and svymean
sayantikaSSG Nov 16, 2022
962ae50
few modifications to src files
sayantikaSSG Nov 16, 2022
f5a5292
settings
sayantikaSSG Nov 16, 2022
61670af
Merge branch 'design_update' of github.com:sayantikaSSG/Survey.jl int…
sayantikaSSG Nov 16, 2022
4c7bbf6
Merge pull request #3 from smishr/domain_stratified_sample
smishr Nov 22, 2022
e6a90de
Merge branch 'xKDR:design_update' into design_update
smishr Nov 22, 2022
2a64eb8
Delete settings.json
smishr Nov 22, 2022
05a54df
Update .gitignore
smishr Nov 22, 2022
946591f
Update svymean.jl
smishr Nov 22, 2022
6fe3e44
Update SurveyDesign.jl
smishr Nov 22, 2022
3d5fccc
Merge pull request #92 from sayantikaSSG/design_update
smishr Nov 22, 2022
191f84e
Merge branch 'xKDR:design_update' into design_update
smishr Nov 22, 2022
f2dd1d2
Update SRS struct, Add type checking, reorder
smishr Nov 23, 2022
a3936b0
Remove accidental twice fn declaration
smishr Nov 23, 2022
6bc4094
Editing sayantika SRS tests
smishr Nov 23, 2022
fa8a01a
Add and reorder type checks on weights
smishr Nov 23, 2022
3cdf066
Edited weights and probs checking
smishr Nov 23, 2022
94fd34f
Add ErrorException to @test_throws lines
smishr Nov 23, 2022
36b35c0
popsize sampsize Unsigned not Integer
smishr Nov 23, 2022
e1149da
Add testthrows for type checking keywords
smishr Nov 23, 2022
39c060a
ingorefpc improvements still not 100%, revert T,S parametric types
smishr Nov 25, 2022
79af6ab
line by line adding tests SRS
smishr Nov 25, 2022
9331edd
Ran Julia Formatter
smishr Nov 25, 2022
9aca851
Change Float64 to <:Real as sometime Int64
smishr Nov 25, 2022
9a42e84
Add popsize Symbol StratifiedSample
smishr Nov 25, 2022
94586d1
Fixed Strat and SurveyDesign tests for time being
smishr Nov 25, 2022
0eb9f6e
Fix testing suite with ignorefpc=true
smishr Nov 25, 2022
2c4a62e
Edit StratifiedSample with latest SRS checks
smishr Nov 25, 2022
091d980
Fix show, svyby for Stratified
smishr Nov 25, 2022
c0c36c2
Update src/SurveyDesign.jl
smishr Nov 26, 2022
8eefd75
Update src/SurveyDesign.jl
smishr Nov 26, 2022
60be750
Update src/SurveyDesign.jl
smishr Nov 26, 2022
d92c63d
Update src/SurveyDesign.jl
smishr Nov 26, 2022
2751ae3
Update src/SurveyDesign.jl
smishr Nov 26, 2022
6a2fff3
Update src/SurveyDesign.jl
smishr Nov 26, 2022
b9f09a1
Update src/SurveyDesign.jl
smishr Nov 26, 2022
3ea908c
Update src/SurveyDesign.jl
smishr Nov 26, 2022
b0b10c1
Merge pull request #94 from smishr/design_update
smishr Nov 26, 2022
412def0
lowercase errors, doctring StratifiedSample
smishr Nov 26, 2022
c2fce09
Add more StratifiedSample tests
smishr Nov 27, 2022
471bde2
Merge branch 'design_update' into design_update_stratified
smishr Nov 27, 2022
efd9b38
Updating readme according to the new design
ayushpatnaikgit Nov 27, 2022
004eb07
Merge pull request #96 from ayushpatnaikgit/design_update
smishr Nov 28, 2022
05e4be2
Merge branch 'design_update' of https://github.com/smishr/Survey.jl i…
smishr Nov 28, 2022
31b9990
Fix sampsize>popsize error
smishr Nov 28, 2022
e563431
Add more test sampsize>popsize
smishr Nov 28, 2022
fdfd8d7
Changed weights to popsize, doctest warnings
smishr Nov 28, 2022
4c6bb85
more jldoctest fixes
smishr Nov 28, 2022
0918e46
Corrected jldoctest Stratified
smishr Nov 28, 2022
a4b9790
Merge pull request #95 from smishr/design_update_stratified
smishr Nov 28, 2022
d7bab80
add binary files to gitignore
smishr Nov 28, 2022
749d334
Merge pull request #89 from iuliadmtru/categorical_array_support
smishr Nov 29, 2022
b5075de
remove svy ctrl replace
smishr Nov 29, 2022
b670f54
Edited `svy` removal statements
smishr Nov 29, 2022
d3b0022
Merge branch 'xKDR:design_update' into design_update
smishr Nov 29, 2022
2df075a
Categorical array changes
smishr Nov 29, 2022
30ba3d2
Revert "Change output of `svymean` and `svytotal` for `CategoricalArr…
smishr Nov 29, 2022
9c47a62
Merge pull request #101 from xKDR/revert-89-categorical_array_support
smishr Nov 29, 2022
7511106
Merge pull request #100 from smishr/remove_svy
smishr Nov 29, 2022
533f9db
Merge branch 'xKDR:design_update' into design_update
smishr Nov 29, 2022
b791b94
Add tests mean SRS
smishr Nov 29, 2022
5907fa8
Merge pull request #102 from smishr/design_update
smishr Nov 29, 2022
4b9c8c1
Add CategoricalArrays dependancy in tests. Fix test failure in PR 102.
ayushpatnaikgit Nov 30, 2022
3805768
Merge pull request #105 from ayushpatnaikgit/design_update
ayushpatnaikgit Nov 30, 2022
be38de7
Rearrange sections and other changes.
ayushpatnaikgit Nov 30, 2022
2cfd6b7
Adding information in API reference outside @docs macro
ayushpatnaikgit Dec 1, 2022
a87da92
Update docs/src/R_comparison.md
ayushpatnaikgit Dec 2, 2022
3d83250
Update docs/src/R_comparison.md
ayushpatnaikgit Dec 2, 2022
137428b
Update docs/src/R_comparison.md
ayushpatnaikgit Dec 2, 2022
07349bf
Update docs/src/R_comparison.md
ayushpatnaikgit Dec 2, 2022
2a35d10
Update src/load_data.jl
ayushpatnaikgit Dec 2, 2022
dc18ab0
Change writing of arguments in `SimpleRandomSample` docstring
iuliadmtru Dec 2, 2022
77cf28a
Change writing of arguments in `StratifiedSample` docstring
iuliadmtru Dec 2, 2022
cdb1bd9
Update docs/src/api.md
ayushpatnaikgit Dec 2, 2022
a1b2e24
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
028fb72
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
f0edfe9
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
7469cca
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
7bcabd4
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
6faf51a
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
e65b2de
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
7d4853e
Cleaning up
ayushpatnaikgit Dec 2, 2022
87142f5
Make SRS docstring more concise.
ayushpatnaikgit Dec 2, 2022
1f7921c
Add tests for `SimpleRandomSample`
iuliadmtru Dec 2, 2022
e1e1d6e
Add tests for `StratifiedSample` for `total`
iuliadmtru Dec 2, 2022
89d8141
Remove `by` and do domain estimation in `mean` and `total`
ayushpatnaikgit Dec 3, 2022
e9f88cb
Cleanup. Add doctest and rename output elements.
ayushpatnaikgit Dec 3, 2022
3e27e4b
Merge pull request #106 from ayushpatnaikgit/design_update
ayushpatnaikgit Dec 3, 2022
a43d0d3
Remove `by` from R_comparison
ayushpatnaikgit Dec 4, 2022
f34e750
Update src/mean.jl
ayushpatnaikgit Dec 4, 2022
2127eed
Update src/mean.jl
ayushpatnaikgit Dec 4, 2022
0fd7903
Rearrange sections and other changes.
ayushpatnaikgit Nov 30, 2022
f7f2cf3
Adding information in API reference outside @docs macro
ayushpatnaikgit Dec 1, 2022
d5b4f30
Update docs/src/R_comparison.md
ayushpatnaikgit Dec 2, 2022
c3bb5ae
Update docs/src/R_comparison.md
ayushpatnaikgit Dec 2, 2022
247a107
Update docs/src/R_comparison.md
ayushpatnaikgit Dec 2, 2022
c5b1e2d
Update docs/src/R_comparison.md
ayushpatnaikgit Dec 2, 2022
29d2b50
Update src/load_data.jl
ayushpatnaikgit Dec 2, 2022
2434bb8
Change writing of arguments in `SimpleRandomSample` docstring
iuliadmtru Dec 2, 2022
c7bc83a
Change writing of arguments in `StratifiedSample` docstring
iuliadmtru Dec 2, 2022
7ced080
Update docs/src/api.md
ayushpatnaikgit Dec 2, 2022
2279111
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
5439b30
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
47d9a7e
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
8de236e
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
81df82e
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
ad27279
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
c7d63b7
Update src/SurveyDesign.jl
ayushpatnaikgit Dec 2, 2022
196e0c0
Make SRS docstring more concise.
ayushpatnaikgit Dec 2, 2022
b33a549
Change column names to `total` and `SE`
iuliadmtru Dec 4, 2022
fde61b6
Update src/mean.jl
ayushpatnaikgit Dec 4, 2022
006588e
Update src/mean.jl
ayushpatnaikgit Dec 4, 2022
45c88f5
Add type bounds to function signature instead of body
iuliadmtru Dec 4, 2022
a6abe1c
Remove `@show` from constructors
iuliadmtru Dec 4, 2022
28d0711
Merge pull request #114 from ayushpatnaikgit/cleaning
ayushpatnaikgit Dec 4, 2022
34dddcc
Remove extra docstrings and reorder methods
iuliadmtru Dec 4, 2022
0bf786d
Merge previous changes and resolve conflicts
iuliadmtru Dec 4, 2022
c5b21a3
Remove extra docstrings and reorder methods for `total`
iuliadmtru Dec 4, 2022
c2dede6
Add new lines, function signature and rephrase docstring
iuliadmtru Dec 4, 2022
905d7db
Use SE in total of categorical variable
ayushpatnaikgit Dec 4, 2022
17dd17a
Use SE in mean of categorical variable.
ayushpatnaikgit Dec 4, 2022
7f3c25a
Merge pull request #116 from iuliadmtru/design_types
ayushpatnaikgit Dec 4, 2022
690a424
Remove strata means
smishr Dec 5, 2022
ec3927d
Merge pull request #118 from ayushpatnaikgit/cleaning
smishr Dec 5, 2022
4ba2223
Merge pull request #117 from iuliadmtru/mean_docs
ayushpatnaikgit Dec 5, 2022
124af32
Merge changes from design_update branch
iuliadmtru Dec 5, 2022
1235673
Make a copy of the original dataset
iuliadmtru Dec 5, 2022
436b1d1
Remove unnecessary variables and comment
iuliadmtru Dec 5, 2022
c481c92
Remove unnecessary parameter for `se`
iuliadmtru Dec 5, 2022
67acbeb
Merge pull request #112 from iuliadmtru/total_tests
smishr Dec 5, 2022
5107796
Merge pull request #122 from iuliadmtru/total_improvements
smishr Dec 5, 2022
9e7a2ae
Remove old design from tests
iuliadmtru Dec 6, 2022
6632f7d
Remove old design methods
iuliadmtru Dec 6, 2022
0c32205
Remove old design
iuliadmtru Dec 6, 2022
de52790
Merge pull request #126 from iuliadmtru/remove_old_design
smishr Dec 6, 2022
7467d9a
Edit mean references
smishr Dec 6, 2022
5d665f9
updated quantile
smishr Dec 6, 2022
73cfd66
change quantile tests
smishr Dec 6, 2022
90570f2
Merge branch 'design_update' of https://github.com/smishr/Survey.jl i…
smishr Dec 6, 2022
346e444
quantile tests updated template
smishr Dec 6, 2022
84b924f
Update readme according to changes in SRC
ayushpatnaikgit Dec 7, 2022
53fbecb
Merge pull request #128 from ayushpatnaikgit/readme2
ayushpatnaikgit Dec 7, 2022
0d72347
Fix quantile for SRS
smishr Dec 7, 2022
cb95f95
Add test quantile SRS
smishr Dec 7, 2022
0d91268
Merge branch 'design_update' of https://github.com/smishr/Survey.jl i…
smishr Dec 7, 2022
f8ab7dc
FIx SRS quantile tests
smishr Dec 8, 2022
12506a6
Remove `ClusterSample` `SurveyDesign`
smishr Dec 8, 2022
d472207
Merge pull request #127 from smishr/quantile
smishr Dec 8, 2022
7f67771
Remove @show SurveyDesign
smishr Dec 8, 2022
4137998
Merge branch 'xKDR:design_update' into design_update
smishr Dec 8, 2022
a5602c2
Merge pull request #131 from smishr/design_update
smishr Dec 8, 2022
c91580b
Add quantile example README
smishr Dec 8, 2022
02d749b
Merge pull request #132 from smishr/design_update
smishr Dec 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
/docs/Manifest.toml
/docs/build/
/test/Manifest.toml
/dev/*
.gitignore
.DS_Store
*.json
3 changes: 1 addition & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ version = "0.11.1"
AlgebraOfGraphics = "cbdf2221-f076-402e-a563-3d30da359d67"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Expand All @@ -18,6 +18,5 @@ AlgebraOfGraphics = "0.6"
CSV = "0.10"
CairoMakie = "0.8, 0.9"
DataFrames = "1"
GLM = "1"
StatsBase = "0.33"
julia = "1"
179 changes: 81 additions & 98 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,121 +7,104 @@
[![Milestones](https://img.shields.io/badge/-milestones-brightgreen)](https://github.com/xKDR/Survey.jl/milestones)


This package is used to study complex survey data. It is the Julia implementation of the [Survey package in R](https://cran.r-project.org/web/packages/survey/index.html) developed by [Professor Thomas Lumley](https://www.stat.auckland.ac.nz/people/tlum005).
This package is used to study complex survey data. It aims to be a fast alternative to the [Survey package in R](https://cran.r-project.org/web/packages/survey/index.html) developed by [Professor Thomas Lumley](https://www.stat.auckland.ac.nz/people/tlum005).

As the size of survey datasets have become larger, processing the records can take hours or days in R. We endeavour to solve this problem by implementing the Survey package in Julia.
This package currently supports simple random sample and stratified sample. In future releases, it will support multistage sampling as well.

## How to install

add "https://github.com/xKDR/Survey.jl.git"

## Basic usage

In the following example, we will load the Academic Performance Index dataset for Californian schools and produce the weighted mean for each county.
```julia
using Survey

apiclus1 = load_data("apiclus1")
## This function loads a commonly used dataset, Academic Performance Index (API), as an example.
## Any DataFrame object can be used with this package.

dclus1 = svydesign(id = :1, weights = :pw, data = apiclus1)

svyby(:api00, :cname, dclus1, svymean)
11×3 DataFrame
Row │ cname mean SE
│ String15 Float64 Float64
─────┼────────────────────────────────
1 │ Alameda 669.0 16.2135
2 │ Fresno 472.0 9.85278
3 │ Kern 452.5 29.5049
4 │ Los Angeles 647.267 23.5116
5 │ Mendocino 623.25 24.216
6 │ Merced 519.25 10.4925
7 │ Orange 710.562 28.9123
8 │ Plumas 709.556 13.2174
9 │ San Diego 659.436 12.2082
10 │ San Joaquin 551.189 11.578
11 │ Santa Clara 732.077 12.2291
```

This example is from the Survey package in R. The [examples section of the documentation](https://xkdr.github.io/Survey.jl/dev/examples/) shows the R and the Julia code side by side for this and a few other examples.

## Performance
We will measure the performance of the R and Julia for the example shown above.

**R**

```R
library(survey)
library(microbenchmark)
data(api)
dclus1 <- svydesign(id = ~1, weights = ~pw, data = apiclus1)
microbenchmark(svyby(~api00, by = ~cname, design = dclus1, svymean), units = "us")
] add "https://github.com/xKDR/Survey.jl.git"
```
## Basic usage

```R
expr min lq
svyby(~api00, by = ~cname, design = dclus1, svymean) 10180.47 12102.61
mean median uq max neval
12734.43 12421.93 12788.55 17242.35 100
```
### Simple Random Sample

**Julia**
In the following example, we will load a simple random sample of the Academic Performance Index dataset for Californian schools and do basic analysis.
```julia
using Survey, BenchmarkTools
apiclus1 = load_data("apiclus1")
dclus1 = svydesign(id=:1, weights=:pw, data = apiclus1)
@benchmark svyby(:api00, :cname, dclus1, svymean)
```
using Survey

```julia
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
Range (min … max): 54.464 μs … 6.070 ms ┊ GC (min … max): 0.00% … 94.01%
Time (median): 72.468 μs ┊ GC (median): 0.00%
Time (mean ± σ): 81.833 μs ± 190.657 μs ┊ GC (mean ± σ): 7.62% ± 3.23%
```

The Julia code is about 171 times faster than the R code.

We increase the complexity by grouping the data by two variables and then performing the same operations.
**R**

```R
library(survey)
library(microbenchmark)
data(api)
dclus1 <- svydesign(id = ~1, weights = ~pw, data = apiclus1)
microbenchmark(svyby(~api00, by = ~cname+meals, design = dclus1, svymean, keep.var = FALSE), units = "us")
srs = load_data("apisrs")

dsrs = SimpleRandomSample(srs; weights = :pw)

mean(:api00, dsrs)
1×2 DataFrame
Row │ mean SE
│ Float64 Float64
─────┼──────────────────
1 │ 656.585 9.24972

total(:enroll, dsrs)
1×2 DataFrame
Row │ total SE
│ Float64 Float64
─────┼─────────────────────
1 │ 3.62107e6 1.6952e5

mean(:api00, :cname, dsrs)
38×3 DataFrame
Row │ cname mean SE
│ String15 Float64 Float64
─────┼────────────────────────────────────
1 │ Kern 573.6 42.8026
2 │ Los Angeles 658.156 21.0728
3 │ Orange 749.333 27.0613
⋮ │ ⋮ ⋮ ⋮
36 │ Napa 727.0 46.722
37 │ Lake 804.0 NaN
38 │ Merced 595.0 NaN

quantile(:enroll,dsrs,[0.1,0.2,0.5,0.75,0.95])
5×2 DataFrame
Row │ probability quantile
│ Float64 Float64
─────┼───────────────────────
1 │ 0.1 245.5
2 │ 0.2 317.6
3 │ 0.5 453.0
4 │ 0.75 668.5
5 │ 0.95 1473.1
```

```R
Unit: microseconds
expr min lq
svyby(~api00, by = ~cname + meals, design = dclus1, svymean) 132468.1 149914
mean median uq max neval
166121.9 160571.3 172301.6 304979.2 100
```
### Stratified Sample

**Julia**
```julia
using Survey, BenchmarkTools
apiclus1 = load_data("apiclus1")
dclus1 = svydesign(id=:1, weights=:pw, data = apiclus1)
@benchmark svyby(:api00, [:cname, :meals], dclus1, svymean)
```
In the following example, we will load a stratified sample of the Academic Performance Index dataset for Californian schools and do basic analysis.

```julia
BenchmarkTools.Trial: 10000 samples with 1 evaluation.
Range (min … max): 219.387 μs … 8.284 ms ┊ GC (min … max): 0.00% … 90.94%
Time (median): 265.214 μs ┊ GC (median): 0.00%
Time (mean ± σ): 325.100 μs ± 513.020 μs ┊ GC (mean ± σ): 14.23% ± 8.58%
```
using Survey

The Julia code is about 605 times faster than the R code.
strat = load_data("apistrat")

dstrat = StratifiedSample(strat, :stype; weights = :pw, popsize = :fpc)

mean(:api00, dstrat)
1×2 DataFrame
Row │ mean SE
│ Float64 Float64
─────┼──────────────────
1 │ 662.287 9.40894

total(:api00, dstrat)
1×2 DataFrame
Row │ total SE
│ Float64 Float64
─────┼────────────────────
1 │ 4.10221e6 58279.0

mean(:api00, :cname, dstrat)
40×3 DataFrame
Row │ cname mean SE
│ String15 Float64 Float64
─────┼───────────────────────────────────────
1 │ Los Angeles 633.511 21.3912
2 │ Ventura 707.172 31.6856
3 │ Kern 678.235 53.1337
⋮ │ ⋮ ⋮ ⋮
39 │ Mendocino 632.018 1.04942
40 │ Butte 627.0 0.0
```

## Strategic goals

We want to implement all the features provided by the [Survey package in R](https://cran.r-project.org/web/packages/survey/index.html)

The [milestones](https://github.com/xKDR/Survey.jl/milestones) sections of the repository contains a list of features that contributors can implement in the short-term.
Expand Down
6 changes: 3 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ makedocs(;
),
pages=[
"Home" => "index.md",
"Examples" => "examples.md",
"Comparison with R" => "R_comparison.md",
"Performance" => "performance.md",
"Moving from R" => "R_comparison.md",
"API reference" => "api.md"
],
checkdocs=:exports,
)

deploydocs(;
Expand Down
Loading