Sha256: bf603212185bbce1814159c066e6003a1ee2d14ad5f4c6ce073491a8fdeb5600
Contents?: true
Size: 1.79 KB
Versions: 2
Compression:
Stored size: 1.79 KB
Contents
$reliability_icc=nil require(File.dirname(__FILE__)+'/helpers_tests.rb') class StatsampleReliabilitySkillScaleTestCase < MiniTest::Unit::TestCase context Statsample::Reliability::SkillScaleAnalysis do setup do options=%w{a b c d e} cases=20 @id=cases.times.map {|v| v}.to_scale @a=cases.times.map {options[rand(5)]}.to_vector @b=cases.times.map {options[rand(5)]}.to_vector @c=cases.times.map {options[rand(5)]}.to_vector @d=cases.times.map {options[rand(5)]}.to_vector @e=cases.times.map {rand()>0.8 ? nil : options[rand(5)]}.to_vector @ds={'id'=>@id,'a'=>@a,'b'=>@b,'c'=>@c,'d'=>@d,'e'=>@e}.to_dataset @key={'a'=>options[rand(5)], 'b'=>options[rand(5)], 'c'=>options[rand(5)], 'd'=>options[rand(5)],'e'=>options[rand(5)]} @ssa=Statsample::Reliability::SkillScaleAnalysis.new(@ds, @key) @ac=@a.map {|v| v==@key['a'] ? 1 : 0}.to_scale @bc=@b.map {|v| v==@key['b'] ? 1 : 0}.to_scale @cc=@c.map {|v| v==@key['c'] ? 1 : 0}.to_scale @dc=@d.map {|v| v==@key['d'] ? 1 : 0}.to_scale @ec=@e.map {|v| v.nil? ? nil : (v==@key['e'] ? 1 : 0)}.to_scale end should "return proper corrected dataset" do cds={'id'=>@id, 'a'=>@ac,'b'=>@bc,'c'=>@cc,'d'=>@dc, 'e'=>@ec}.to_dataset assert_equal(cds, @ssa.corrected_dataset) end should "return proper corrected minimal dataset" do cdsm={'a'=>@ac,'b'=>@bc,'c'=>@cc,'d'=>@dc, 'e'=>@ec}.to_dataset assert_equal(cdsm, @ssa.corrected_dataset_minimal) end should "return correct vector_sum and vector_sum" do cdsm=@ssa.corrected_dataset_minimal assert_equal(cdsm.vector_sum, @ssa.vector_sum) assert_equal(cdsm.vector_mean, @ssa.vector_mean) end should "return valid summary" do assert(@ssa.summary.size>0) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
statsample-0.18.0 | test/test_reliability_skillscale.rb |
statsample-0.17.0 | test/test_reliability_skillscale.rb |