Fsdb::F...tistats(3)

πŸ“¦
version 3.9 Β· 3 versions
, in epel 9

πŸ’… Fsdb::F...tistats(3): dbmultistats πŸ’…

User Contributed Perl Documentation β€” yes bestie, it’s a Perl-manual moment, and we’re making it cute ✨


🌸 NAME 🌸

dbmultistats β€” run dbcolstats over each group of inputs identified by some key. Slay, per-group stats 😌


✨ SYNOPSIS ✨

$0 [-dm] [-c ConfidencePercent] [-f FormatForm] [-q NumberOfQuartiles]
-k KeyField ValueField

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so picture this: the input table gets grouped by KeyField, and then we compute a separate set of column statistics on ValueField for each group with a unique key. It’s giving β€œstats, but make it grouped” πŸ’…

Assumptions and requirements are the same as dbmapreduce (this program is just a wrapper around that program), fr fr:

  • 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 -S option, 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, program consumes O(1) memory, but doesn’t verify that the data-arrival precondition is met.
Note that these semantics are exactly like running 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. (Yes, β€œquarties” is right there in the original, don’t come for me 😭)

πŸŽ€ OPTIONS πŸŽ€

Options are the same as dbcolstats. Here’s the whole menu, bestie β€” vibe check each one πŸ‘‘

  • -k or --key KeyField β€” specify which column is the key for grouping (default: the first column).
  • --output-on-no-input β€” Enables null output (all fields are "-", n is 0) 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.
  • -a or --include-non-numeric β€” Compute stats over all records (treat non-numeric records as zero rather than just ignoring them).
  • -c FRACTION or --confidence FRACTION β€” Specify FRACTION for the confidence interval. Defaults to 0.95 for a 95% confidence factor.
  • -f FORMAT or --format FORMAT β€” Specify a printf(3)-style format for output statistics. Defaults to "%.5g".
  • -m or --median β€” Compute median value. (Will sort data if necessary.) (Median is the quantitle for N=2.) Yes, β€œquantitle” is also from the original β€” iconic typo behavior πŸ’€
  • -q N or --quantile N β€” Compute quantile (quartile when N is 4), or an arbitrary quantile for other values of N, where the scores that are 1 Nth of the way across the population.
  • -S or --pre-sorted β€” Assume data is already sorted. With one -S, we check and confirm this precondition. When repeated, we skip the check.
  • -T TmpDir β€” where to put temporary data. Only used if median or quantiles are requested. Also uses environment variable TMPDIR, if -T is not specified. Default is /tmp.
  • --parallelism=N or -j N β€” Allow up to N reducers to run in parallel. Default is the number of CPUs in the machine.
  • -F or --fs or --fieldseparator S β€” Specify the field (column) separator as "S". See dbfilealter for valid field separators.

This module also supports the standard fsdb options, bestie:

  • -d β€” Enable debugging output.
  • -i or --input InputSource β€” Read from InputSource, typically a file name, or "-" for standard input, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.
  • -o or --output OutputDestination β€” Write to OutputDestination, typically a file name, or "-" for standard output, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.
  • --autorun or --noautorun β€” By default, programs process automatically, but Fsdb::Filter objects in Perl do not run until you invoke the run() method. The "--(no)autorun" option controls that behavior within Perl.
  • --header H β€” Use H as 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

πŸ‘‘ SEE ALSO πŸ‘‘

Go give these their flowers too:

  • Fsdb.
  • dbmapreduce.
  • dbcolstats.

🫢 CLASS FUNCTIONS 🫢

🌟 new

$filter = new Fsdb::Filter::dbmultistats(@arguments);

Create a new dbmultistats object, taking command-line arguments.

⭐ set_defaults

$filter->set_defaults();

Internal: set up defaults.

πŸ’« parse_options

$filter->parse_options(@ARGV);

Internal: parse command-line arguments.

πŸ¦‹ setup

$filter->setup();

Internal: setup, parse headers.

Pass the right options to dbmapreduce and dbcolstats.

🌸 run

$filter->run();

Internal: run over each rows.

πŸŽ€ finish

$filter->finish();

Internal: write trailer.


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.


That’s the whole page, bestie 🫢 Signing off from perl v5.32.1, dated 2024-08-02, as Fsdb::F...tistats(3) πŸ’–βœ¨

πŸ“¦ where this page comes from