3.30 mmvstats - Compute Statistics of Sliding Window

Calculate various statistics (1 variable) for sliding windows. This a variant of the mstats command with functionality to compute sliding windows.

Format

mmvstats [s=] [k=] f= [t=] c= [skip=] [i=] [o=] [-nfn] [-nfno] [-x] [-q] [precision=] [--help] [--version]

Parameters

s=

After the specified field is sorted (multiple fields can be specified), various statistics is computed.

 

s= parameter is required when -q is not specified.

k=

Aggregate records using the specified field name(s) (multiple fields can be specified).

f=

Field name(s) (multiple fields can be specified) for computation .

t=

Integer interval greater than 1.

c=

Type of statistics (specify one of the following list)

 

sum|mean|devsq|var|uvar|sd|usd|cv|min|

 

|max|range|skew|uskew|kurt|ukurt

 

Refer to mstats for detailed definitions.

skip=

Specify the number of rows to hide from the top in the output.

Example

Example 1: Basic Example

Calculate sum of sliding window. The first row is not printed as there is less than the required nubmer of intervals for computation.

$ more dat1.csv
id,value
1,5
2,1
3,3
4,4
5,4
6,6
7,1
8,4
9,7
$ mmvstats s=id f=value t=2 c=sum i=dat1.csv o=rsl1.csv
#END# kgmvstats c=sum f=value i=dat1.csv o=rsl1.csv s=id t=2
$ more rsl1.csv
id%0,value
2,6
3,4
4,7
5,8
6,10
7,7
8,5
9,11

Related Commands

mmvavg : Calculate moving average.

mwindow : Create sliding window data for use with mmvstats for the computation of statistics.

mmvsim : Compute the similarity measure (bivariate statistics) .