CoefficientOfVariation (FPScript)

21.09.2021

Calculates the absolute or relative coefficient of variation for a data set.

Syntax

CoefficientOfVariation(DataSet, [ Mode = CV_ABSOLUTE + PROCESS_ROWS ] [ , IntervalWidth ])

 

The syntax of the CoefficientOfVariation function consists of the following parts:

Part

Description

DataSet

The data set to be evaluated.

All data structures are allowed. All numeric data types are permitted.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Mode

Specifies how data matrices and signal series are to be processed and whether individual, moving or block coefficients are to be determined.

The argument Mode can have the following values:

Constant

Meaning

CV_ABSOLUTE

Calculates the absolute coefficient of variation.

CV_RELATIVE

Calculates the relative coefficient of variation.

This is also called a normalized coefficient of variation.

...plus a constant, which determines the processing of data matrices and signal series...

Constant

Meaning

+ PROCESS_COLUMNS

Processing takes place column by column. The result contains one value per column.

+ PROCESS_ROWS

Processing takes place row by row. The result contains one value per row.

+ PROCESS_COMPLETE

Processing is done globally. The result contains one value for the whole data set.

...plus an optional constant, which determines the calculation method:

Constant

Meaning

+ CALC_BLOCK

Block-by-block calculation. One value is calculated per interval.

+ CALC_MOVING

Moving calculation. For every value in the data set, a result is determined in the specified interval.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value CV_ABSOLUTE + PROCESS_ROWS.

IntervalWidth

This argument is required for determining moving and block coefficients. The interval width then specifies the number of values to be examined. The width should be an odd number. Otherwise, the interval is asymmetrical, and one more value is included in the calculation to the right of the center as opposed to the left.

Permitted data structures are scalar value. All integral data types are permitted.

The value must be greater or equal to 1.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Remarks

The result always has the data type 64-bit floating point.

The absolute coefficient of variation of a sample is defined as:

The relative coefficient of variation of a sample is defined as:

with the mean

and standard deviation

For signals and signal series, the Y component is processed and the X or Z component is copied, if possible. When calculating floating-point and block coefficients, the data structure of the result corresponds to that of the argument. If, on the other hand, DataSet is a data series or a signal, the result is a scalar value with the coefficient of variation searched for. Otherwise, the result is a data series or a signal with one coefficient of variation per column or row.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

CoefficientOfVariation({100, 100, 100})

Results in 0. The data set with constant values has a standard deviation of 0 and a mean of 100, which results in a coefficient of variation of 0 / 100 = 0.

CoefficientOfVariation({90, 100, 110})

Results in 0.1. The data set with higher variability has a standard deviation of 10 and a mean of 100, which results in a coefficient of variation of 10 / 100 = 0.1.

CoefficientOfVariation({1, 5, 6, 8, 10, 40, 65, 88})

Results in 1.18042521004003. The data set with even higher variability results in an even higher coefficient.

CoefficientOfVariation({1, 5, 6, 8, 10, 40, 65, 88}, CV_RELATIVE)

Results in 0.4461587924395862. Corresponds to CoefficientOfVariation({1, 5, 6, 8, 10, 40, 65, 88}) / Sqrt(7).

CoefficientOfVariation({{90, 100, 110}, {990, 1000, 1010}}, PROCESS_COLUMNS)

Results in {0.1, 0.01}.

CoefficientOfVariation({{90, 990}, {100, 1000}, {110, 1010}})

Results in {0.1, 0.01}.

CoefficientOfVariation({90, 100, 110, 100, 90}, CALC_MOVING, 3)

Results in { 0.0744322927564787, 0.1, 0.05587260669577074, 0.1, 0.0744322927564787 }. The function calculates the coefficient of variation for {90, 100}, {90, 100, 110}, {100, 110, 100}, {110, 100, 90} and {100, 90}.

CoefficientOfVariation({90, 100, 110, 990, 1000, 1010}, CALC_BLOCK, 3)

Results in {0.1, 0.01}. The function calculates the coefficient of variation for the blocks {90, 100, 110} and {990, 1000, 1010}.

See Also

Statistical Quantity Analysis Object

Share article or send as email:

You might be interested in these articles