calcStats function

Extract statistics from events