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