diff --git a/Project.toml b/Project.toml index bc530ab..2c0e2e8 100644 --- a/Project.toml +++ b/Project.toml @@ -21,6 +21,7 @@ CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" MetidaBase = "075456b7-4006-432f-9324-2f8453996c49" +StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" [targets] -test = [ "Test", "CSV", "DataFrames", "MetidaBase"] +test = [ "Test", "CSV", "DataFrames", "MetidaBase", "StatsBase"] diff --git a/test/runtests.jl b/test/runtests.jl index c6bb076..02570e3 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,5 +1,6 @@ using MetidaStats using MetidaBase +using StatsBase using Test using DataFrames, CSV @@ -24,4 +25,57 @@ io = IOBuffer(); @test des[:, :mean] == des2[:, :mean] show(io, des) + + sort!(des2, [:col, :row, :Variable]) + + @test des2[:, :n] == [24 + 22 + 44 + 44 + 20 + 20 + 83 + 83] + + @test des2[:, :mean] ≈ [51.84339580144830000 + -3.2427526832130800 + 58.06263961606340000 + 1.8800364385656400 + 51.84107641126520000 + 0.4353627340913350 + 47.25778648204360000 + -3.2515999935069800] + + @test des2[:, :sd] ≈ [30.67890817616400000 + 26.7334282254075000 + 26.95184403646440000 + 28.9591749375126000 + 25.29979111399270000 + 27.5437061096263000 + 27.16599075359280000 + 28.8185876098308000] + + @test des2[:, :se] ≈ [6.26230590810839000 + 5.6995860482981700 + 4.06314336714229000 + 4.3657598866360500 + 5.65720527474328000 + 6.1589599213400700 + 2.98185487195489000 + 3.1632509429411400] + + @test des2[1, :geom] ≈ 39.7551197516893 + @test des2[3, :geom] ≈ 48.4385401710072 + @test des2[5, :harmmean] ≈ 38.7909224529887 + @test des2[7, :harmmean] ≈ 15.394283582287837 + + di = MetidaStats.dataimport(ds, vars = [:var1, :var2], sort = [:col, :row]) + sort!(di, [:col, :row, :Variable]) + + + des2[1, :skew] ≈ skewness(di[1].obs) + + + des2[1, :kurt] ≈ kurtosis(di[1].obs) + end