prob icon indicating copy to clipboard operation
prob copied to clipboard

Overflow/underflow

Open carbocation opened this issue 7 years ago • 0 comments

The chi square CDF does not account for underflow or overflow and therefore can emit (very) wrong answers.

package demo

import (
	"math"
	"testing"

	"github.com/atgjack/prob"
)

func TestProb(t *testing.T) {
	N := 200.0

	v := prob.ChiSquared{1}
	t.Log(1 - v.Cdf(N))
}

This will yield ~ 0.4933. The correct answer is approximately 0. Either extremes chi square values should be handled, or an error (or a panic, as is done by the probab/dst functions) should be returned. (I'm using github.com/tokenme/probab/dst instead so I don't plan on submitting a pull request -- my apologies -- but I do want to at least mention the issue.)

carbocation avatar Dec 31 '18 02:12 carbocation