moments function

Function to calculate statistical moments