Open GregorySchwartz opened 7 years ago
Good catch! Would you mind to provide fix for it?
This would change correlation
, pearson
, and pearsonMatByRow
to return Maybe
as well. pearsonMatByRow
may have issues as well if the Matrix
type should have Nothing
as elements rather than throwing out the entire matrix, because there is no instance for Unbox (Maybe a)
.
Ohhh... It's going to be a big change. Feel free to share your opinion on the matter
I starting to think that we should do such conversion and return Nothing when no result could be computed. We could do it incrementally and start by convertin correlation
& pearson
. And decide what to do with pearsonMatByRow
later
That sounds fine, but maybe return Nothing
for pearsonMatByRow
? The only issue is when finding bugs, it would be a tad more annoying to see which comparison is returning Nothing
.
I've started addressing this here: https://github.com/DataHaskell/statistics/tree/exceptions-not-error
spearman
should return Nothing rather than NaN:spearman $ V.fromList [(1, 3), (5, 3)]
, or any case where one of the two variables is a constant.