xKDR / Survey.jl

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

Updated variance( ) function #308

Closed nadiaenh closed 10 months ago

nadiaenh commented 11 months ago

Closes #295 and #301

nadiaenh commented 11 months ago

@ayushpatnaikgit My doctests are failing most of the time but I can't figure out why, here is one of the error messages :

┌ Error: doctest failure in ~/Survey.jl/src/mean.jl:47-55
│
│ ```jldoctest; setup = :(using Survey, StatsBase; apiclus1 = load_data("apiclus1"); dclus1 = SurveyDesign(apiclus1; clusters = :dnum, weights = :pw); bclus1 = dclus1 |> bootweights;)
│
│ julia> mean(:api00, bclus1)
│ 1×2 DataFrame
│  Row │ mean     SE
│      │ Float64  Float64
│ ─────┼──────────────────
│    1 │ 644.169  23.4107
│ ```
│
│ Subexpression:
│
│ mean(:api00, bclus1)
│
│ Evaluated output:
│
│ 1×2 DataFrame
│  Row │ mean     SE
│      │ Float64  Float64
│ ─────┼──────────────────
│    1 │ 644.169  23.4107
│
│ Expected output:
│
│
│
│   diff =
│    1×2 DataFrame
│     Row │ mean     SE
│         │ Float64  Float64
│    ─────┼──────────────────
│       1 │ 644.169  23.4107
└ @ Documenter.DocTests ~/Survey.jl/src/mean.jl:47

and here is that doctest:

jldoctest; setup = :(using Survey, StatsBase; apiclus1 = load_data("apiclus1"); dclus1 = SurveyDesign(apiclus1; clusters = :dnum, weights = :pw); bclus1 = dclus1 |> bootweights;)

julia> mean(:api00, bclus1)
1×2 DataFrame
 Row │ mean     SE
     │ Float64  Float64
─────┼──────────────────
   1 │ 644.169  23.4107

They are failing for all the updated files with the same kind of error message (expected X, evaluated X). Running the doctest manually in Julia (after dev .) works, and running julia make.jl sometimes doesn't give error message but most of the times does.

codecov-commenter commented 11 months ago

Codecov Report

Merging #308 (ae2daa1) into main (735613e) will decrease coverage by 2.34%. The diff coverage is 91.54%.

@@             Coverage Diff             @@
##              main     #308      +/-   ##
===========================================
- Coverage   100.00%   97.66%   -2.34%     
===========================================
  Files           14       14              
  Lines          242      257      +15     
===========================================
+ Hits           242      251       +9     
- Misses           0        6       +6     
Files Changed Coverage Δ
src/quantile.jl 87.50% <57.14%> (-12.50%) :arrow_down:
src/ratio.jl 76.92% <72.72%> (-23.08%) :arrow_down:
src/SurveyDesign.jl 100.00% <100.00%> (ø)
src/bootstrap.jl 100.00% <100.00%> (ø)
src/by.jl 100.00% <100.00%> (ø)
src/jackknife.jl 100.00% <100.00%> (ø)
src/mean.jl 100.00% <100.00%> (ø)
src/total.jl 100.00% <100.00%> (ø)
ayushpatnaikgit commented 11 months ago

@ayushpatnaikgit My doctests are failing most of the time but I can't figure out why, here is one of the error messages :

┌ Error: doctest failure in ~/Survey.jl/src/mean.jl:47-55
│
│ ```jldoctest; setup = :(using Survey, StatsBase; apiclus1 = load_data("apiclus1"); dclus1 = SurveyDesign(apiclus1; clusters = :dnum, weights = :pw); bclus1 = dclus1 |> bootweights;)
│
│ julia> mean(:api00, bclus1)
│ 1×2 DataFrame
│  Row │ mean     SE
│      │ Float64  Float64
│ ─────┼──────────────────
│    1 │ 644.169  23.4107
│ ```
│
│ Subexpression:
│
│ mean(:api00, bclus1)
│
│ Evaluated output:
│
│ 1×2 DataFrame
│  Row │ mean     SE
│      │ Float64  Float64
│ ─────┼──────────────────
│    1 │ 644.169  23.4107
│
│ Expected output:
│
│
│
│   diff =
│    1×2 DataFrame
│     Row │ mean     SE
│         │ Float64  Float64
│    ─────┼──────────────────
│       1 │ 644.169  23.4107
└ @ Documenter.DocTests ~/Survey.jl/src/mean.jl:47

and here is that doctest:

jldoctest; setup = :(using Survey, StatsBase; apiclus1 = load_data("apiclus1"); dclus1 = SurveyDesign(apiclus1; clusters = :dnum, weights = :pw); bclus1 = dclus1 |> bootweights;)

julia> mean(:api00, bclus1)
1×2 DataFrame
 Row │ mean     SE
     │ Float64  Float64
─────┼──────────────────
   1 │ 644.169  23.4107

They are failing for all the updated files with the same kind of error message (expected X, evaluated X). Running the doctest manually in Julia (after dev .) works, and running julia make.jl sometimes doesn't give error message but most of the times does.

“sometimes doesn't give error message but most of the times does”, is a little weird. It difficult for me to help you on this remotely. Generally speaking, doctests are a bit difficult to get around.

ayushpatnaikgit commented 10 months ago

PR #304 addresses this.