ds_list_standard_score
In statistics, the standard score is the (signed) number of standard deviations an observation or datum is above the mean. Thus, a positive standard score indicates a datum above the mean, while a negative standard score indicates a datum below the mean. It is a dimensionless quantity obtained by subtracting the population mean from an individual raw score and then dividing the difference by the population standard deviation.
The standard score of a raw score x is
$$\large z = {x- \mu \over \sigma}$$
where: \(\mu\) is the mean of the population; \(\sigma\) is the standard deviation of the population
- ds_list_standard_score(id,pos)
- Returns the standard score (z-score) of the value at a given position in a given list.
COPY/// ds_list_standard_score(id,pos)
//
// Returns the standard score (z-score) of the
// value at a given position in a given list.
//
// id list data structure, real
// pos position in the list, real
//
/// GMLscripts.com/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 (ds_list_find_value(argument0, argument1) - avg)/sqrt(sum/n);
}
Contributors: Quimp
GitHub: View · Commits · Blame · Raw