Answers for "bash calculate the standard deviation of a column"

1

bash calculate the standard deviation of a column

# Example usage:
awk '{delta = $1 - avg; avg += delta / NR; mean2 += delta * ($1 - avg); } END { print sqrt(mean2 / NR); }' input_file
# This produces the standard deviation for column 1. Change the 1s to
# whichever column number you want.

# Example usage 2:
awk ‘{delta = $1 – avg; avg += delta / NR; mean2 += delta * ($1 – avg); } END { print sqrt(mean2 / (NR-1)); }’ input_file
# This is the calculation for a sample instead of a population
Posted by: Guest on October-10-2020

Code answers related to "bash calculate the standard deviation of a column"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language