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_score

Wikipedia:

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

z=xμσ

where: μ is the mean of the population; σ 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
  1. /// ds_list_standard_score(id,pos)
  2. //
  3. // Returns the standard score (z-score) of the
  4. // value at a given position in a given list.
  5. //
  6. // id list data structure, real
  7. // pos position in the list, real
  8. //
  9. /// gmlscripts.pro/license
  10. {
  11. var n, avg, sum, i;
  12. n = ds_list_size(argument0);
  13. avg = 0;
  14. sum = 0;
  15.  
  16. for (i=0; i<n; i+=1) avg += ds_list_find_value(argument0, i);
  17. avg /= n;
  18. for (i=0; i<n; i+=1) sum += sqr(ds_list_find_value(argument0, i) - avg);
  19.  
  20. return (ds_list_find_value(argument0, argument1) - avg)/sqrt(sum/n);
  21. }

Contributors: Quimp

GitHub: View · Commits · Blame · Raw