Sha256: 85d37f6b630fd5d5fcc94abc8453c511f8602be3d71b799d6fe09592d683adb5

Contents?: true

Size: 691 Bytes

Versions: 5

Compression:

Stored size: 691 Bytes

Contents

require(File.dirname(__FILE__)+'/test_helpers.rb')

class StatsampleLogitTestCase < MiniTest::Unit::TestCase
  def test_logit_1
    crime=File.dirname(__FILE__)+'/../data/test_binomial.csv'
    ds=Statsample::CSV.read(crime)
    lr=Statsample::Regression::Binomial::Logit.new(ds,'y')
    assert_in_delta(-38.8669,lr.log_likehood,0.001)
    assert_in_delta(-5.3658,lr.constant,0.001)

    exp_coeffs={"a"=>0.3270,"b"=>0.8147, "c"=>-0.4031}
    exp_coeffs.each{|k,v|
      assert_in_delta(v,lr.coeffs[k],0.001)
    }
    exp_errors={'a'=>0.4390,'b'=>0.4270,'c'=>0.3819}
    exp_errors.each{|k,v|
      assert_in_delta(v,lr.coeffs_se[k],0.001)
    }
    assert_equal(7,lr.iterations)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
statsample-0.10.0 test/test_logit.rb
statsample-0.9.0 test/test_logit.rb
statsample-0.8.2 test/test_logit.rb
statsample-0.8.1 test/test_logit.rb
statsample-0.8.0 test/test_logit.rb