Moved the statistical calculation algorithm code into a separate file.
Added unit test to these calculations, and fixed a calculation error.
p4#: 21140