basic-stats(1)

NAME

basic-stats - Command-line statistics made trivial

SYNOPSIS

basic-stats z-score x mean stddev
basic-stats z-cdf z-score [mean stddev] (defaults: 0 1)
basic-stats t-score x-bar expected-mean stddev n
basic-stats [--verbose] [--delim string] \
	    function1 [param1] --row|--col N \
	    [function2 ...]

OPTIONS

--verbose
    Echo input data during processing

--delim string
    Use string as a set of delimiters instead of the default " \t"

--row N
    Compute statistics for row N (1-based) of the input

--col N
    Compute statistics for column N (1-based) of the input

mean --row|--col N
    Compute the mean (average) for row/column N

quantile partitions --row|--col N
    Compute the low, high, and quantiles for row/column N

median --row|--col N
    Compute the low, high, and median for row/column N. Identical to quantile 2 --row|--col N.

quartile --row|--col N
    Identical to quantile 4 --row|--col N.

pop-var --row|--col N
    Report population variance

pop-stddev --row|--col N
    Report population standard deviation

pop-z-scores --row|--col N
    Report population z-scores

sample-var --row|--col N
    Report sample variance

sample-stddev --row|--col N
    Report sample standard deviation

sample-z-scores --row|--col N
    Report sample z-scores. Should only be used for sample sizes of 30 or more. Otherwise, use sample-t-score.

sample-stderr --row|--col N
    Report sample standard error (sigma-x-bar = stddev / sqrt(n))

sample-t-score --row|--col N
    Report t-score for sample data.

mode --row|--col N
    Report mode

range --row|--col N
    Report range

iq-range --row|--col N
    Report interquartile range

PURPOSE
Basic-stats is a program for quickly computing statistics on tabular data from the command-line. It elimintes the nuisance of importing data into a spreadsheet or writing custom scripts in order to gather basic statistics.

DESCRIPTION
Basic-stats computes common statistics such as mean, median, etc. on rows and/or columns of tabular data. It can compute multiple functions on multiple rows and/or columns in a single pass through the input stream. The default delimiter is either a single TAB or multiple space characters. Alternate delimiters, such as a comma, can be specified using, e.g. --delim ','. Quantiles are computed using a generalized interpolation formula (method 4 from the Wikipedia page on quartiles). The output format is designed to be both human-readable and easily parsed by command-line tools and scripts. Basic-stats is written entirely in C for maximal performance. Memory use is trivial for many functions, but some computations such as quantiles which involve sorting the data require the use of arrays.

EXAMPLES
> cat sample.txt
1    5  21
2   12  22
3   13  23
4   14  24
5   15  25
6   16  26
7   17  27
8   18  28
9   19  29
10  20  30
> basic-stats mean --col 1 median --row 2 quantile 4 --col 3 < sample.txt
Col 1 mean           5.500000
Row 2 low            2.000000
Row 2 quantile(0.50) 12.000000
Row 2 high           22.000000
Col 3 low            21.000000
Col 3 quantile(0.25) 22.750000
Col 3 quantile(0.50) 25.500000
Col 3 quantile(0.75) 28.250000
Col 3 high           30.000000

SEE ALSO
awk(1), R(1)

BUGS
Please report bugs to the author and send patches in unified diff format. (man diff for more information)

AUTHOR
J. Bacon