stats - Calcurate statistics of values in each column
stats [-v] [-t type[,type...]] [file...]
This manual page documents stats. This program is for calcurating various statistics of values in each column. stats can compute several statistics: the number of values, sum, minimum, maximum, mean, variance, standard deviation, coefficient of variation, 25%/50%/75% quantiles, and 90%/95%/99% confidence interlvals. stats can also compute statistic for multiple data sets: covariance and correlation coefficient.
stats calcurates statistics of numbers in all lines, located at the same column position. For instance, if the input file has N colums, stats displays statistics for these N columns.
The input file format of stats is straightforward; each column is
seperated by whitespace, and each value is any valid Perl number. See
perlre(1) and perlnumber(1) for details of whitespace characters
and valid number formats.
Display label for each statistic
Specify statistic to display. type must be one of the following keywordss.
count the number of values sum sum min minimum max maximum mean sample mean var sample variance stddev standard deviation cv coefficient of variation quant25 25% quantile quant50 50% quantile quant75 75% quantile conf90 90% confidence interval conf95 95% confidence interval conf99 99% confidence interval covar covariance corr correlation coefficient
$ seq 10 1 2 3 4 5 6 7 8 9 10
$ seq 10 | stats -v count 10.0000 sum 55.0000 min 1.0000 max 10.0000 mean 5.5000 var 8.2500 stddev 2.8723 cv 52.2233 quant25 3.0000 quant50 6.0000 quant75 8.0000 conf90 1.4941 conf95 1.7803 conf99 2.3398
$ seq 10 | stats -t mean
5.5000
Also, you can specify list of statistics to display.
$ seq 1 10 | stats -t mean,var
5.5000
8.2500
$ seq 10 | column -c 16 1 6 2 7 3 8 4 9 5 10
$ seq 10 | column -c 16 | stats -v count 5.0000 5.0000 sum 15.0000 40.0000 min 1.0000 6.0000 max 5.0000 10.0000 mean 3.0000 8.0000 var 2.0000 2.0000 stddev 1.4142 1.4142 cv 47.1405 17.6777 quant25 2.0000 7.0000 quant50 3.0000 8.0000 quant75 4.0000 9.0000 conf90 1.0404 1.0404 conf95 1.2396 1.2396 conf99 1.6292 1.6292
% cd /usr/src/linux/net/ipv4
% ls -l *.c -rw-r--r-- 1 root staff 29313 Nov 29 2003 af_inet.c -rw-r--r-- 1 root staff 33868 Apr 14 2004 arp.c -rw-r--r-- 1 root staff 31912 Apr 14 2004 devinet.c -rw-r--r-- 1 root staff 15044 Aug 25 2003 fib_frontend.c -rw-r--r-- 1 root staff 21003 Aug 25 2003 fib_hash.c -rw-r--r-- 1 root staff 11564 Feb 18 2004 fib_rules.c -rw-r--r-- 1 root staff 25791 Aug 25 2003 fib_semantics.c -rw-r--r-- 1 root staff 27842 Apr 14 2004 icmp.c -rw-r--r-- 1 root staff 53725 Apr 14 2004 igmp.c -rw-r--r-- 1 root staff 14530 Oct 2 2001 inetpeer.c -rw-r--r-- 1 root staff 4131 Apr 13 2001 ip_forward.c -rw-r--r-- 1 root staff 16226 Jun 13 2003 ip_fragment.c -rw-r--r-- 1 root staff 32291 Nov 29 2003 ip_gre.c -rw-r--r-- 1 root staff 13138 Aug 3 2002 ip_input.c -rw-r--r-- 1 root staff 4349 Apr 13 2001 ip_nat_dumb.c -rw-r--r-- 1 root staff 14331 Nov 29 2002 ip_options.c -rw-r--r-- 1 root staff 25271 Nov 29 2003 ip_output.c -rw-r--r-- 1 root staff 25436 Apr 14 2004 ip_sockglue.c -rw-r--r-- 1 root staff 34923 Nov 29 2003 ipconfig.c -rw-r--r-- 1 root staff 22332 Nov 29 2003 ipip.c -rw-r--r-- 1 root staff 40373 Nov 29 2003 ipmr.c -rw-r--r-- 1 root staff 7526 Jun 13 2003 proc.c -rw-r--r-- 1 root staff 4345 May 20 2001 protocol.c -rw-r--r-- 1 root staff 16381 Aug 25 2003 raw.c -rw-r--r-- 1 root staff 65629 Nov 29 2003 route.c -rw-r--r-- 1 root staff 5198 Aug 3 2002 syncookies.c -rw-r--r-- 1 root staff 9608 Apr 14 2004 sysctl_net_ipv4.c -rw-r--r-- 1 root staff 70143 Feb 18 2004 tcp.c -rw-rw-r-- 1 root staff 15180 Aug 25 2003 tcp_diag.c -rw-r--r-- 1 root staff 120806 Apr 14 2004 tcp_input.c -rw-r--r-- 1 root staff 58649 Apr 14 2004 tcp_ipv4.c -rw-r--r-- 1 root staff 29731 Aug 25 2003 tcp_minisocks.c -rw-r--r-- 1 root staff 43280 Nov 29 2003 tcp_output.c -rw-r--r-- 1 root staff 17652 Jun 13 2003 tcp_timer.c -rw-r--r-- 1 root staff 26360 Apr 14 2004 udp.c -rw-r--r-- 1 root staff 1272 Aug 25 2003 utils.c
% ls -l *.c | awk '{ print $5 }' | stats -v
count 36.0000
sum 1010643.0000
min 1272.0000
max 136404.0000
mean 28073.4167
var 621397171.6319
stddev 24927.8393
cv 88.7952
quant25 14359.0000
quant50 25342.0000
quant75 34573.0000
conf90 6834.3826
conf95 8143.0942
conf99 10702.3523
The latest version of stats is available at
http://www.ispl.jp/~oosaki/software/stats/stats
perl(1), perlnumber(1), perlre(1)
Hiroyuki Ohsaki <oosaki[atmark]ist.osaka-u.ac.jp>