Sha256: 04684b903b48a7bd08a180ee54289c775db3051c6b87f94dc99511420898c102

Contents?: true

Size: 985 Bytes

Versions: 6

Compression:

Stored size: 985 Bytes

Contents

require(File.expand_path(File.dirname(__FILE__) + '/helpers_tests.rb'))

class StatsampleBartlettSphericityTestCase < Minitest::Test
  include Statsample::Test
  context Statsample::Test::BartlettSphericity do
    setup do
      @v1 = Daru::Vector.new([1, 2, 3, 4, 7, 8, 9, 10, 14, 15, 20, 50, 60, 70])
      @v2 = Daru::Vector.new([5, 6, 11, 12, 13, 16, 17, 18, 19, 20, 30, 0, 0, 0])
      @v3 = Daru::Vector.new([10, 3, 20, 30, 40, 50, 80, 10, 20, 30, 40, 2, 3, 4])
      # KMO: 0.490
      ds = Daru::DataFrame.new({ :v1 => @v1, :v2 => @v2, :v3 => @v3 })
      cor = Statsample::Bivariate.correlation_matrix(ds)
      @bs = Statsample::Test::BartlettSphericity.new(cor, 14)
    end
    should 'have correct value for chi' do
      assert_in_delta(9.477, @bs.value, 0.001)
    end
    should 'have correct value for df' do
      assert_equal(3, @bs.df)
    end
    should 'have correct value for probability' do
      assert_in_delta(0.024, @bs.probability, 0.001)
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
statsample-ekatena-2.0.2.1 test/test_bartlettsphericity.rb
statsample-ekatena-2.0.2 test/test_bartlettsphericity.rb
statsample-2.1.0 test/test_bartlettsphericity.rb
statsample-2.0.2 test/test_bartlettsphericity.rb
statsample-2.0.1 test/test_bartlettsphericity.rb
statsample-2.0.0 test/test_bartlettsphericity.rb