pycogent/pycogent — pull request #17 by jrrideout (2013-02-27 22:12:29+00:00)
Title: Bug fixes for t_two_sample and mc_t_two_sample.

Fixed bug in ```cogent.maths.stats.test.t_two_sample``` that returned a t-statistic with the wrong sign if the first distribution contained multiple values and the second distribution contained only a single value (this was validated against R's t.test). Unit test has been updated accordingly.

```cogent.maths.stats.test.mc_t_two_sample``` now handles distributions (as well as permuted distributions) without variance (in the past it would crash with an uninformative error message in these cases). For example, if comparing ```[1,1,2]``` to ```[2,2,1]```, a possible permutation is ```[1,1,1]``` vs ```[2,2,2]```, which would return a t-statistic of ```None```. This caused ```mc_t_two_sample``` to crash. This was validated against R's Deducer::perm.t.test.

To fix these bugs, added new optional argument ```none_on_zero_variance``` to ```cogent.maths.stats.test.t_two_sample``` and ```cogent.maths.stats.test.t_one_observation``` that is ```True``` by default to not modify the previous behavior or change the interface of the two functions.

Updated and added unit tests for these special cases.

This issue arose from @gregcaporaso's [new test data in QIIME](https://github.com/qiime/qiime/issues/582). I've verified that the changes here fix the issues that arose in the QIIME unit test suite.