datamash -t, --header-in pcov 2:4 < data.csv

Category: Data Science & Analysis

datamash -t, --header-in pcov 2:4 < data.csv

Compute population covariance between columns 2 and 4

The pcov operation reports the population covariance of the two fields given as a colon pair, columns 2 and 4 here. Covariance measures how two variables move together, with positive values meaning they rise and fall in step. Unlike correlation it is not bounded to the -1 to 1 range, so its magnitude depends on the units of the data. Use spearson for a unit-free measure of association.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.