stats
Manual Reference Pages - STATS (1)
stats - calculate some statistics.
CONTENTS
Syntax
Description
Options
Copyright
SYNTAX
stats [options] [file]
DESCRIPTION
Calculate statistics for given frames of each input file and write theresults on the stdout.If no filenames are given, one input file is expected on the stdin.Otherwise each given filename is processed in turn.
OPTIONS
1. frame, width, samplerate
The frame option selects a sequence of contiguous frames for processing by:
frame=a[-b]where a and b are frame numbers: 1,2,3,...,max The upper limit b isoptional, and when it is missing then the frame sequence is a singleframe, otherwise a and b are inclusive limits. The strings "min"and "max" are recognised as extreme limits.Each frame has size width samples whichmay be given with time units (s or ms), in which case the theyare converted to a number of samples using the given samplerate option.The special option value "width=max" is interpreted as a single frame coveringthe whole file.
2. type
Datatype for both input and output. Binary types are char, short, int, float, double.Ascii input (one number per line) is recognised with "type=ascii".
3. stat
The statistics available to the stat option are:
n sample (ie. data set) size sum area ss sum of squares mean sum/n rms root mean square: square root of ss/n variance computed with n-1 degrees of freedom stddev standard deviation: square root of variance min minimum value max maximum value absmax maximum absolute value, ie. max( |max|, |min| ) range max-minThe variance is the average squared deviation from the mean value, where theaverage is computed by dividing by n-1 for a data set of n samples.The stddev is the square root of this variance.The stddev would be equal to the rms value for a data set with zero mean,except that the average squared value is computed using ss/n, while theaverage squared deviation from a zero mean value is computed using ss/(n-1).
Statistics may be given in a comma separated list, for example:
stats stat=mean,variance,min,maxFor each frame of each input file this will output the four statistics in thedata type selected by the type option.
4. line
When line=on (or -l) output is forced to be ascii irrespective of the type option,and for each file argument in turn stats prints the statistics requested,in the order they were requested, on one line.This makes a table (one line per file), and also helps subsequent operationsbetween statistics. For example, the standard error of the mean (the stddevdivided by the square root of the sample size) can be computed:
stats -l stat=stddev,n | awk { print $1 / sqrt($2) }Tables can be formatted using field-width and precision arguments which areincluded as silent options. For example, to format columns with a precisionof 4 decimal places with each number right-justified in a field-width of12 characters:
stats -l fieldwidth=12 precision=4The columns may be left-justified by making the fieldwidth parameter negative.Output is truncated to integers by setting the precision parameter 0.For example, to print the sample size of each file as an integer withoutsetting in a field:
stats -l fieldwidth=0 precision=0 stat=n [files]
SEE ALSO
options
COPYRIGHT
Copyright (c) Applied Psychology Unit, Medical Research Council, 1995
Permission to use, copy, modify, and distribute this software without feeis hereby granted for research purposes, provided that this copyrightnotice appears in all copies and in all supporting documentation, and thatthe software is not redistributed for any fee (except for a nominalshipping charge). Anyone wanting to incorporate all or part of thissoftware in a commercial product must obtain a license from the MedicalResearch Council.
The MRC makes no representations about the suitability of thissoftware for any purpose. It is provided "as is" without express orimplied warranty.
THE MRC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDINGALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALLTHE A.P.U. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGESOR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THISSOFTWARE.
| SunOS 5.6 | STATS (1) | 1 September 1993 |