AngularJS SPA to calculate mean, median, and mode