From 72872810fbc2b748786e0f388d9f054390b17b6f Mon Sep 17 00:00:00 2001 From: sayantikaSSG Date: Fri, 16 Dec 2022 21:59:45 +0530 Subject: [PATCH 1/3] Add tests for mean.jl --- test/mean.jl | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/test/mean.jl b/test/mean.jl index 1221a0aa..176c4b2d 100644 --- a/test/mean.jl +++ b/test/mean.jl @@ -39,15 +39,40 @@ end @testset "mean_Stratified" begin - ## Add tests + apistrat_original = load_data("apistrat") + apistrat = copy(apistrat_original) + strat = StratifiedSample(apistrat, :stype; popsize = :fpc) + mean_strat = mean(:api00, strat) + @test mean_strat.mean[1] ≈ 662.287 atol = 1e-2 + @test mean_strat.SE[1] ≈ 9.40894 atol = 1e-2 end @testset "mean_svyby_SimpleRandomSample" begin ## Add tests + apisrs_original = load_data("apisrs") + apisrs = copy(apisrs_original) + srs = SimpleRandomSample(apisrs, popsize = :fpc) + mean_symb_srs = mean(:api00, :stype, srs) + @test mean_symb_srs.mean[1] ≈ 605.36 atol = 1e-2 + @test mean_symb_srs.mean[2] ≈ 666.141 atol = 1e-2 + @test mean_symb_srs.mean[3] ≈ 654.273 atol = 1e-2 + @test mean_symb_srs.SE[1] ≈ 21.9266 atol = 1e-2 + @test mean_symb_srs.SE[2] ≈ 11.1935 atol = 1e-2 + @test mean_symb_srs.SE[3] ≈ 21.8261 atol = 1e-2 end @testset "mean_svyby_Stratified" begin ## Add tests + apistrat_original = load_data("apistrat") + apistrat = copy(apistrat_original) + strat = StratifiedSample(apistrat, :stype; popsize = :fpc) + mean_strat_symb = mean(:api00,:stype, strat) + @test mean_strat_symb.mean[1] ≈ 674.43 atol = 1e-2 + @test mean_strat_symb.mean[2] ≈ 636.6 atol = 1e-2 + @test mean_strat_symb.mean[3] ≈ 625.82 atol = 1e-2 + @test mean_strat_symb.SE[1] ≈ 12.3825 atol = 1e-2 + @test mean_strat_symb.SE[2] ≈ 16.2147 atol = 1e-2 + @test mean_strat_symb.SE[3] ≈ 14.9371 atol = 1e-2 end From d25097c657c18040370e71610e4473fa4c14f24e Mon Sep 17 00:00:00 2001 From: smishr <43640926+smishr@users.noreply.github.com> Date: Sat, 17 Dec 2022 10:55:20 +0530 Subject: [PATCH 2/3] remove comment Co-authored-by: Ayush Patnaik --- test/mean.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/test/mean.jl b/test/mean.jl index 176c4b2d..0144a852 100644 --- a/test/mean.jl +++ b/test/mean.jl @@ -48,7 +48,6 @@ end end @testset "mean_svyby_SimpleRandomSample" begin - ## Add tests apisrs_original = load_data("apisrs") apisrs = copy(apisrs_original) srs = SimpleRandomSample(apisrs, popsize = :fpc) From 7dd464b27efd56b48f60b4d293581348a32a32b0 Mon Sep 17 00:00:00 2001 From: smishr <43640926+smishr@users.noreply.github.com> Date: Sat, 17 Dec 2022 10:55:39 +0530 Subject: [PATCH 3/3] clean up comment Co-authored-by: Ayush Patnaik --- test/mean.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/test/mean.jl b/test/mean.jl index 0144a852..0cd59684 100644 --- a/test/mean.jl +++ b/test/mean.jl @@ -61,7 +61,6 @@ end end @testset "mean_svyby_Stratified" begin - ## Add tests apistrat_original = load_data("apistrat") apistrat = copy(apistrat_original) strat = StratifiedSample(apistrat, :stype; popsize = :fpc)