DBMULTISTATS(1)
π DBMULTISTATS(1) π
okay so before we even get into it β this is dbmultistats(1), and it lives in the User Contributed Perl Documentation section of the manual. yes bestie, perl. we love a legacy icon. π
β¨ NAME β¨
dbmultistats β run dbcolstats over each group of inputs identified by some key. that's it, that's the whole vibe: group first, stats second, slay. π
πΈ SYNOPSIS πΈ
$0 [-dm] [-c ConfidencePercent] [-f FormatForm] [-q NumberOfQuartiles]
-k KeyField ValueField
π¦ DESCRIPTION π¦
so here's the whole thing: the input table gets grouped by KeyField, and then we compute a separate set of column statistics on ValueField for each group that has a unique key. one key, one stat set, no cap. β¨
Assumptions and requirements are the same as dbmapreduce β because this program is literally just a wrapper around that program (iconic behavior, honestly):
- By default, data can be provided in arbitrary order, and the program consumes O(number of unique tags) memory and O(size of data) disk space.
- With the
-Soption, data must arrive group by tags (not necessarily sorted), and the program consumes O(number of tags) memory and no disk space. The program will check and abort if this precondition is not met. - With two
-S's, the program consumes O(1) memory, but doesn't verify that the data-arrival precondition is met. π
ngl that last one is giving "trust me bro" energy β you're on your own for the verification, bestie.
(Note that these semantics are exactly like:
dbmapreduce -k KeyField -- dbcolstats ValueField
dbmultistats provides a simpler API that passes through statistics-specific arguments and is optimized when data is pre-sorted and there are no quarties or medians.)
π OPTIONS π
Options are the same as dbcolstats. but let's go through them together, obviously π«Ά
-kor--keyKeyFieldβ specify which column is the key for grouping (default: the first column).--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.-aor--include-non-numericβ Compute stats over all records (treat non-numeric records as zero rather than just ignoring them).-cFRACTIONor--confidenceFRACTIONβ SpecifyFRACTIONfor the confidence interval. Defaults to0.95for a 95% confidence factor.-fFORMATor--formatFORMATβ Specify aprintf(3)-style format for output statistics. Defaults to"%.5g".-mor--medianβ Compute median value. (Will sort data if necessary.) (Median is the quantitle forN=2.)-qNor--quantileNβ Compute quantile (quartile whenNis4), or an arbitrary quantile for other values ofN, where the scores that are 1 Nth of the way across the population.-Sor--pre-sortedβ Assume data is already sorted. With one-S, we check and confirm this precondition. When repeated, we skip the check.-TTmpDirβ where to put temporary data. Only used if median or quantiles are requested. Also uses environment variableTMPDIR, if-Tis not specified. Default is/tmp.--parallelism=Nor-jNβ Allow up toNreducers to run in parallel. Default is the number of CPUs in the machine.-For--fsor--fieldseparatorSβ Specify the field (column) separator as"S". Seedbfilealterfor valid field separators.
This module also supports the standard fsdb options:
-dβ Enable debugging output.-ior--inputInputSourceβ Read fromInputSource, typically a file name, or"-"for standard input, or (if in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobjects.-oor--outputOutputDestinationβ Write toOutputDestination, typically a file name, or"-"for standard output, or (if in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobjects.--autorunor--noautorunβ By default, programs process automatically, butFsdb::Filterobjects in Perl do not run until you invoke therun()method. The"--(no)autorun"option controls that behavior within Perl.--headerHβ UseHas the full Fsdb header, rather than reading a header from then input.--helpβ Show help.--manβ Show full manual.
π SAMPLE USAGE π
π Input:
#fsdb experiment duration
ufs_mab_sys 37.2
ufs_mab_sys 37.3
ufs_rcp_real 264.5
ufs_rcp_real 277.9
π Command:
cat DATA/stats.fsdb | dbmultistats -k experiment duration
π Output:
#fsdb experiment mean stddev pct_rsd conf_range conf_low conf_high conf_pct sum sum_squared min max n
ufs_mab_sys 37.25 0.070711 0.18983 0.6353 36.615 37.885 0.95 74.5 2775.1 37.2 37.3 2
ufs_rcp_real 271.2 9.4752 3.4938 85.13 186.07 356.33 0.95 542.4 1.4719e+05 264.5 277.9 2
# | /home/johnh/BIN/DB/dbmultistats experiment duration
look at that output. two groups, two perfect little stat rows. we ate. π₯
π SEE ALSO π
Fsdb. dbmapreduce. dbcolstats.
like, go read dbmapreduce if you wanna know what's actually happening under the hood, and dbcolstats for where all these stats come from. iykyk π
β 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 and for the little sign-off moment: this gorgeous thing is documented as perl v5.32.1, dated 2024-08-02, and yes it's still filed under DBMULTISTATS(1) in the man pages. go forth and group your stats, bestie β periodt π§π
π¦ 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