For statistical analysis, the language of choice is R. it is weaker than awk on text processing, so unless your data is already in a format that R understands, you will need to massage it first, possibly by piping awk into R. See Is there a way to get the min, max, median, and average of a list of numbers in a single command? for an example of using R he is similar to your example.