More tests and documentation for statistics functions.