DBCOLSTATS(1)
π DBCOLSTATS(1) β compute statistics on a fsdb column π
okay so bestie, this is the DBCOLSTATS(1) page from the User Contributed Perl Documentation shelf, and it is literally about computing stats on a fsdb column. no cap, it's more useful than it sounds. π
πΈ NAME πΈ
dbcolstats β compute statistics on a fsdb column. β¨
π¦ SYNOPSIS π¦
dbcolstats [-amS] [-c ConfidenceFraction] [-q NumberOfQuantiles]
[-w WeightColumn] column
β¨ DESCRIPTION β¨
okay so here's the vibe: this computes statistics over one COLUMN of data. Records with non-numeric stuff are considered null and do not contribute to the stats β unless you pass -a, in which case they get treated as zeros. π
Optionally, with -w, the data can be weighted by a second column. In that case, n returns a weighted count of input rows. π«Ά
Confidence intervals are a t-test (+/- (t_{a/2})*s/sqrt(n)) and assume the population takes a normal distribution with a small number of samples (< 100). π
By default, all stats are computed as a population sample β that's the n-1 term β not as representing the whole population, which uses n. Pick between them with --sample or --nosample. When you measure the entire population, use the latter option. π
The output is probably best looked at after reformatting with dblistize. π
Dbcolstats runs in O(1) memory. Median or quantile requires sorting the data and invokes dbsort. Sorting will run in constant RAM but O(number of records) disk space. If median or quantile is required and the data is already sorted, dbcolstats will run more efficiently with the -S option. β
π OPTIONS π
-a,--include-non-numericβ Compute stats over all records: treat non-numeric records as zero instead of just ignoring them. π-c FRACTION,--confidence FRACTIONβ SpecifyFRACTIONfor the confidence interval. Defaults to0.95for a 95% confidence factor.-f FORMAT,--format FORMATβ Specify aprintf(3)-styleformat for output statistics. Defaults to"%.5g".-m,--medianβ Compute median value. Will sort data if necessary. (Median is the quantitle forN=2.) yes, βquantitleβ is what the page says β iconic typo energy, but it's the quantile forN=2.-q N,--quantile Nβ Compute quantile (quartile whenNis4), or an arbitrary quantile for other values ofN, where the scores are1 Nthof the way across the population.--sampleβ Compute sample population statistics (e.g., the sample standard deviation), assumingn-1degrees of freedom.--nosampleβ Compute whole population statistics (e.g., the population standard devation). page spelling, iykyk.-w,--weight WeightColumnβ Weight the data by theWeightColumn. By default, all rows have weight1.-S,--pre-sortedβ Assume data is already sorted. With one-S, we check and confirm this precondition. When repeated, we skip the check. This flag is ignored if quartiles are not requested.--parallelism=N,-j Nβ Allow sorting to happen in parallel. Defaults on. Only relevant if using non-pre-sorted data with quantiles.-F,--fs,--fieldseparator Sβ Specify the field (column) separator as"S". Seedbfilealterfor valid field separators.-T TmpDir,--tmpdir TmpDirβ Where to put temporary data. Only used if median or quantiles are requested. Also uses environment variableTMPDIR, if-Tis not specified. Default is/tmp. The original line literally shows<B--tmpdir TmpDir>β stray markup chaos, but the long option is--tmpdir TmpDir, iykyk.-k KeyFieldβ Do multi-stats, grouped by each key. Assumes keys are sorted. Usedbmultistatsto guarantee sorting order.--output-on-no-inputβ Enables null output (all fields are"-",nis0) if we get input with a schema but no records. Without this option, just output the schema but no rows. Default: no output if no input.
This module also supports the standard fsdb options: π
-dβ Enable debugging output.-i,--input InputSourceβ Read fromInputSource, typically a file name, or"-"for standard input, or (if in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobjects.-o,--output OutputDestinationβ Write toOutputDestination, typically a file name, or"-"for standard output, or (if in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobjects.--autorun,--noautorunβ By default, programs process automatically, butFsdb::Filterobjects in Perl do not run until you invoke therun()method. The--(no)autorunoption controls that behavior within Perl.--helpβ Show help.--manβ Show full manual.
πΈ SAMPLE USAGE πΈ
π Input:
#fsdb absdiff
0
0.046953
0.072074
0.075413
0.094088
0.096602
# | /home/johnh/BIN/DB/dbrow
# | /home/johnh/BIN/DB/dbcol event clock
# | dbrowdiff clock
# | /home/johnh/BIN/DB/dbcol absdiff
π Command:
cat data.fsdb | dbcolstats absdiff
π Output:
#fsdb mean:d stddev:d pct_rsd:d conf_range:d conf_low:d conf_high:d conf_pct:d sum:d sum_squared:d min:d max:d n:q
0.064188 0.036194 56.387 0.037989 0.026199 0.102180.95 0.38513 0.031271 0 0.096602 6
# | /home/johnh/BIN/DB/dbrow
# | /home/johnh/BIN/DB/dbcol event clock
# | dbrowdiff clock
# | /home/johnh/BIN/DB/dbcol absdiff
# | dbcolstats absdiff
# 0.95 confidence intervals assume normal distribution and small n.
π¦ SEE ALSO π¦
dbmultistats(1), handles multiple experiments in a single file.dblistize(1), to pretty-print the output ofdbcolstats.dbcolpercentile(1), to compute an even more general version of median/quantiles.dbcolstatscores(1), to compute z-scores or t-scores for each rowdbrvstatdiff(1), to see if two sample populations are statistically different.Fsdb.
π BUGS π
The algorithms used to compute variance have not been audited to check for numerical stability. (See http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance).) Variance may be incorrect when standard deviation is small relative to the mean. π
The field "conf_pct" implies percentage, but it's actually reported as a fraction (0.95 means 95%). so don't get it twisted.
Because of limits of floating point, statistics on numbers of widely different scales may be incorrect. See the test cases dbcolstats_extrema for examples. π
π AUTHOR and COPYRIGHT π
Copyright (C) 1991-2024 by John Heidemann <johnh@isi.edu> π
This program is distributed under terms of the GNU general public license, version 2. See the file COPYING with the distribution for details. π
π
okay that's the whole page: source/version perl v5.32.1, dated 2024-08-02, and the manual is DBCOLSTATS(1). byeee bestie, go compute those stats π«Άβ¨
π¦ where this page comes from
- epel 9: perl-Fsdb 2:3.9-1.el9 Β· GPLv2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms