Converted calcNumbersAtAge routine for multiple groups