Sha256: 5e8806a1900bbc92d0fdd7830a681188c8dd501ca2d2f7fbed90328f33e58292

Contents?: true

Size: 1.44 KB

Versions: 6

Compression:

Stored size: 1.44 KB

Contents

require(File.expand_path(File.dirname(__FILE__)+'/helpers_tests.rb'))
class StatsampleAnovaContrastTestCase < MiniTest::Unit::TestCase
  context(Statsample::Anova::Contrast) do
    setup do
      constant=[12,13,11,12,12].to_scale
      frequent=[9,10,9,13,14].to_scale
      infrequent=[15,16,17,16,16].to_scale
      never=[17,18,12,18,20].to_scale
      @vectors=[constant, frequent, infrequent, never]
      @c=Statsample::Anova::Contrast.new(:vectors=>@vectors)
    end
    should "return correct value using c" do
      @c.c([1,-1.quo(3),-1.quo(3),-1.quo(3)])
      #@c.c([1,-0.333,-0.333,-0.333])
      assert_in_delta(-2.6667, @c.psi, 0.0001)
      assert_in_delta(1.0165, @c.se, 0.0001)
      assert_in_delta(-2.623, @c.t, 0.001)
      assert_in_delta(-4.82, @c.confidence_interval[0],0.01)
      assert_in_delta(-0.51, @c.confidence_interval[1],0.01)
      assert(@c.summary.size>0)
    end
    should "return correct values using c_by_index" do
      @c.c_by_index([0],[1,2,3])
      assert_in_delta(-2.6667, @c.psi, 0.0001)
      assert_in_delta(1.0165, @c.se, 0.0001)
      assert_in_delta(-2.623, @c.t, 0.001)
    end
    should "return correct values using incomplete c_by_index" do
      c1=Statsample::Anova::Contrast.new(:vectors=>@vectors, :c=>[0.5,0.5,-1,0])
      c2=Statsample::Anova::Contrast.new(:vectors=>@vectors, :c1=>[0,1],:c2=>[2])
      assert_equal(c1.psi,c2.psi)
      assert_equal(c1.se,c2.se)
      assert_equal(c1.t,c2.t)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
statsample-1.4.1 test/test_anova_contrast.rb
statsample-1.4.0 test/test_anova_contrast.rb
statsample-1.3.1 test/test_anova_contrast.rb
statsample-1.3.0 test/test_anova_contrast.rb
statsample-1.2.0 test/test_anova_contrast.rb
statsample-1.1.0 test/test_anova_contrast.rb