DBCOLMOVINGSTATS(1)
π DBCOLMOVINGSTATS π
okay bestie, so this is a page from the User Contributed Perl Documentation section of your manual, and it's literally all about dbcolmovingstats β a lil tool that computes moving statistics over a window of a column of data. icon behavior tbh π
β¨ NAME β¨
dbcolmovingstats β compute moving statistics over a window of a column of data. that's it, that's the vibe π¦
πΈ SYNOPSIS πΈ
dbcolmovingstats [-am] [-w WINDOW] [-e EmptyValue] [-k KEY] column
like, that's the whole thing. short and slay π
π DESCRIPTION π
So the deal is: we compute moving statistics over a COLUMN of data. Records that contain non-numeric data are considered null and they do not contribute to the stats β unless you pass -a, in which case they get treated as zeros instead of being ignored. pick your fighter β¨
Statitics are computed over a WINDOW of samples of data. (yes, girl, the original page really spells it "Statitics" β we're keeping it, it's part of the lore π«Ά)
π§ [In progress 2020-11-12, but not completed: Alternatively, if a key column is given with -k KEY, then a we treat the key column as a time value and compute the time-weighted mean.]
Currently we compute mean and sample standard deviation. (Note we only compute sample standard deviation, not full population β highkey important distinction, don't @ me.) Optionally, with -m we also compute median. (Currently there is no support for generalized quantiles. sad but true π)
Values before a sufficient number have been accumulated are given the empty value (if specified with -e). If no empty value is given, stats are computed on as many are possible if no empty value is specified.
Dbcolmovingstats runs in O(1) memory, but must buffer a full window of data. Quantiles currently will repeatedly sort the window and so may perform poorly with wide windows. ngl that's the tradeoff bestie π
π OPTIONS π
-a,--include-non-numericβ Compute stats over all records (treat non-numeric records as zero rather than just ignoring them). no record left behind β¨-w,--windowWINDOW β WINDOW of how many items to accumulate (defaults to10). (For compatibility with fsdb-1.x,-nis also supported. iykyk π§)-k,--keyKEY β The KEY specifies a field that is used to evaluate the window β a window must span at most this range of value so the key field. (For example, if KEY is the time and window is60, then enough samples will be added to make at most 60s of observations. With a key, sampling can be irregular.) If key is specified, we also output amoving_nfield for how many samples are in each window. irregular sampling? she understood the assignment π-m,--medianβ Show median of the window in addition to mean. median girlies rise πΈ-eE,--emptyE β Give value E as the value for empty (null) records. This null value is then output before a full window is accumulated.-fFORMAT,--formatFORMAT β Specify aprintf(3)-style format for output mean and standard deviation. Defaults to"%.5g". dress your numbers up, bestie π
Eventually we expect to support other options of dbcolstats.
π the standard fsdb options (she comes with extras) π
This module also supports the standard fsdb options:
-dβ Enable debugging output.-i,--inputInputSource β Read from InputSource, typically a file name, or"-"for standard input, or (if in Perl) aIO::Handle,Fsdb::IOorFsdb::BoundedQueueobjects.-o,--outputOutputDestination β Write to OutputDestination, 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)autorun"option controls that behavior within Perl.--helpβ Show help. we love a helper π«Ά--manβ Show full manual. (you are literally here rn π₯)
π SAMPLE USAGE π
πΈ Input:
#fsdb date epoch count
19980201 886320000 6
19980202 886406400 8
19980203 886492800 19
19980204 886579200 53
19980205 886665600 20
19980206 886752000 18
19980207 886838400 5
19980208 886924800 9
19980209 887011200 22
19980210 887097600 22
19980211 887184000 36
19980212 887270400 26
19980213 887356800 23
19980214 887443200 6
π¦ Command:
cat data.fsdb | dbmovingstats -e - -w 4 count
π ok yes the command saysdbmovingstatsand notdbcolmovingstatsβ that's literally what the original page says, so we're keeping it exactly. not me being a good archivist π
β¨ Output:
#fsdb date epoch count moving_mean moving_stddev
19980201 886320000 6 - -
19980202 886406400 8 - -
19980203 886492800 19 - -
19980204 886579200 53 21.5 21.764
19980205 886665600 20 25 19.442
19980206 886752000 18 27.5 17.02
19980207 886838400 5 24 20.445
19980208 886924800 9 13 7.1647
19980209 887011200 22 13.5 7.8528
19980210 887097600 22 14.5 8.8129
19980211 887184000 36 22.25 11.026
19980212 887270400 26 26.5 6.6081
19980213 887356800 23 26.75 6.3966
19980214 887443200 6 22.75 12.473
# | dbcolmovingstats -e - -n 4 count
π SEE ALSO π
Fsdb. dbcolstats. dbmultistats. dbrowdiff. go read those too, bestie, they're all part of the friend group π«Ά
π BUGS π
Currently there is no support for generalized quantiles. that's the whole bug section. short king π
β AUTHOR and COPYRIGHT β
Copyright (C) 1991-2022 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.
and that's the tea β β this page is from perl v5.32.1, dated 2024-08-02. 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