Skip to content

Returning NaN for simple multiple linear regression case in 1.4.1 #21

@einpaule

Description

@einpaule

I'm finding some unexpected behaviour in the 1.4.1, which was not occurring in 1.4.0. (I've tried to keep to the format of some of the tests in the test suite in the example):

    @a=[27.0, 12.0, 16.0, 25.0].to_vector(:scale)
    @b=[10.0, 15.0, 19.0, 2.0].to_vector(:scale)
    @y=[1, 1, 1, 1].to_vector(:scale)

    ds={'a'=>@a,'b'=>@b,'y'=>@y}.to_dataset

    lr=Statsample::Regression::Multiple::RubyEngine.new(ds,'y')

    assert(!lr.r.nan?, "r should not be NaN")
    assert(!lr.r2.nan?, "r2 should not be NaN")
    lr.coeffs.each do |(coeff_key, coeff_value)|
      assert(!coeff_value.nan?, "#{coeff_key} should not be NaN")
    end

I've added this as a test on a fork: https://github.com/einpaule/statsample .

Can someone confirm this is an issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions