JuliaStats / HypothesisTests.jl

Hypothesis tests for Julia
Other
292 stars 87 forks source link

FisherExactTest dies horribly on corner case inputs #276

Closed rohanmaddamsetti closed 1 year ago

rohanmaddamsetti commented 2 years ago

Hello,

FisherExactTest() dies horribly if you supply matrices like the following: FisherExactTest(5, 0, 5, 0).

Of course one could say "don't do that", which is reasonable when running statistics interactively, but users like myself may want to run a series of statistical tests on data within a loop, without having to write error-checking code for the inputs going into FisherExactTest().

It would be great if this julia function could gracefully report the outcome rather than dying with an ArgumentError. For comparison, R reports the following given the same input.

fisher.test:
data:  TestMatrix
p-value = 1
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
   0 Inf
sample estimates:
odds ratio 
         0 

Thanks for your consideration, Rohan

nalimilan commented 1 year ago

Indeed. We should detect parameter values which would throw an error if passed to FisherNoncentralHypergeometric as we do now, and instead fill the FisherExactTest object with values similar to what R does. Any help welcome.

ararslan commented 1 year ago

Fixed by #279