1DBCOLMOVINGSTATS(1) User Contributed Perl Documentation DBCOLMOVINGSTATS(1)
2
3
4
6 dbcolmovingstats - compute moving statistics over a window of a column
7 of data
8
10 dbcolmovingstats [-am] [-w window-width] [-e EmptyValue] column
11
13 Compute moving statistics over a COLUMN of data. Records containing
14 non-numeric data are considered null do not contribute to the stats
15 (optionally they are treated as zeros with "-a").
16
17 Currently we compute mean and sample standard deviation. (Note we only
18 compute sample standard deviation, not full population.) Optionally,
19 with "-m" we also compute median. (Currently there is no support for
20 generalized quantiles.)
21
22 Values before a sufficient number have been accumulated are given the
23 empty value (if specified with "-e"). If no empty value is given,
24 stats are computed on as many are possible if no empty value is
25 specified.
26
27 Dbcolmovingstats runs in O(1) memory, but must buffer a full window of
28 data. Quantiles currently will repeatedly sort the window and so may
29 perform poorly with wide windows.
30
32 -a or --include-non-numeric
33 Compute stats over all records (treat non-numeric records as zero
34 rather than just ignoring them).
35
36 -w or --window WINDOW
37 WINDOW of how many items to accumulate (defaults to 10). (For
38 compatibility with fsdb-1.x, -n is also supported.)
39
40 -m or --median
41 Show median of the window in addition to mean.
42
43 -e E or --empty E
44 Give value E as the value for empty (null) records. This null
45 value is then output before a full window is accumulated.
46
47 -f FORMAT or --format FORMAT
48 Specify a printf(3)-style format for output mean and standard
49 deviation. Defaults to "%.5g".
50
51 Eventually we expect to support other options of dbcolstats.
52
53 This module also supports the standard fsdb options:
54
55 -d Enable debugging output.
56
57 -i or --input InputSource
58 Read from InputSource, typically a file name, or "-" for standard
59 input, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue
60 objects.
61
62 -o or --output OutputDestination
63 Write to OutputDestination, typically a file name, or "-" for
64 standard output, or (if in Perl) a IO::Handle, Fsdb::IO or
65 Fsdb::BoundedQueue objects.
66
67 --autorun or --noautorun
68 By default, programs process automatically, but Fsdb::Filter
69 objects in Perl do not run until you invoke the run() method. The
70 "--(no)autorun" option controls that behavior within Perl.
71
72 --help
73 Show help.
74
75 --man
76 Show full manual.
77
79 Input:
80 #fsdb date epoch count
81 19980201 886320000 6
82 19980202 886406400 8
83 19980203 886492800 19
84 19980204 886579200 53
85 19980205 886665600 20
86 19980206 886752000 18
87 19980207 886838400 5
88 19980208 886924800 9
89 19980209 887011200 22
90 19980210 887097600 22
91 19980211 887184000 36
92 19980212 887270400 26
93 19980213 887356800 23
94 19980214 887443200 6
95
96 Command:
97 cat data.fsdb | dbmovingstats -e - -w 4 count
98
99 Output:
100 #fsdb date epoch count moving_mean moving_stddev
101 19980201 886320000 6 - -
102 19980202 886406400 8 - -
103 19980203 886492800 19 - -
104 19980204 886579200 53 21.5 21.764
105 19980205 886665600 20 25 19.442
106 19980206 886752000 18 27.5 17.02
107 19980207 886838400 5 24 20.445
108 19980208 886924800 9 13 7.1647
109 19980209 887011200 22 13.5 7.8528
110 19980210 887097600 22 14.5 8.8129
111 19980211 887184000 36 22.25 11.026
112 19980212 887270400 26 26.5 6.6081
113 19980213 887356800 23 26.75 6.3966
114 19980214 887443200 6 22.75 12.473
115 # | dbcolmovingstats -e - -n 4 count
116
118 Fsdb. dbcolstats. dbmultistats. dbrowdiff.
119
121 Currently there is no support for generalized quantiles.
122
124 Copyright (C) 1991-2018 by John Heidemann <johnh@isi.edu>
125
126 This program is distributed under terms of the GNU general public
127 license, version 2. See the file COPYING with the distribution for
128 details.
129
130
131
132perl v5.30.1 2020-01-30 DBCOLMOVINGSTATS(1)