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_standard_deviation

Wikipedia:

In statistics, the standard deviation (SD) (represented by the Greek letter sigma, σ) is a measure that is used to quantify the amount of variation or dispersion of a set of data values. A low standard deviation indicates that the data points tend to be very close to the mean (also called the expected value) of the set, while a high standard deviation indicates that the data points are spread out over a wider range of values.

$$sx=\sqrt{\frac{\Sigma{x^2}-n\bar{x}^2}{n-1}} \qquad \small \Sigma{x^2}=x_1^2+x_2^2+\cdots+x_n^2 \qquad \bar{x}=\frac{\Sigma{x}}{n} \qquad \Sigma{x}=x_1+x_2+\cdots+x_n$$

ds_list_standard_deviation(id [,sample])
Returns the standard deviation of the values in a given list.
COPY/// ds_list_standard_deviation(id [,sample])
//
//  Returns the standard deviation 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 sqrt(sum/(n - argument1));
}

Contributors: Quimp

GitHub: View · Commits · Blame · Raw