You are currently viewing the gmlscripts.pro static mirror. Forum access and script submissions are not available through this mirror.

Invert gmlscripts.pro

ds_list_vmr

Wikipedia:

In probability theory and statistics, the variance-to-mean ratio (VMR), like the coefficient of variation, is a normalized measure of the dispersion of a probability distribution: it is a measure used to quantify whether a set of observed occurrences are clustered or dispersed compared to a standard statistical model.

It is defined as the ratio of the variance \(\sigma^2\) to the mean \(\mu\),

\( \large D = {\sigma^2 \over \mu } \).

ds_list_vmr(id [,sample])
Returns the variance-to-mean ratio of the values in a given list.
COPY/// ds_list_vmr(id [,sample])
//
//  Returns the variance-to-mean ratio of the values in a given list.
//
//      id          list data structure, real
//      sample      true if the list is made up of a sample, bool
//
/// gmlscripts.pro/license
{
    var n, avg, sum, i;
    n = ds_list_size(argument0);
    avg = 0;
    sum = 0;

    for (i=0; i<n; i+=1) avg += ds_list_find_value(argument0, i);
    avg /= n;
    for (i=0; i<n; i+=1) sum += sqr(ds_list_find_value(argument0, i) - avg);

    return sum/(n - argument1)/avg;
}

Contributors: Quimp

GitHub: View · Commits · Blame · Raw