Returns a range with whatever properties T has (forward range, random access range, bidirectional range, hasLength, etc.), of the z-scores of the underlying range. A z-score of an element in a range is defined as (element - mean(range)) / stdev(range).


If the data contained in the range is a sample of a larger population, rather than an entire population, then technically, the results output from the ZScore range are T statistics, not Z statistics. This is because the sample mean and standard deviation are only estimates of the population parameters. This does not affect the mechanics of using this range, but it does affect the interpretation of its output.

Accessing elements of this range is fairly expensive, as a floating point multiply is involved. Also, constructing this range is costly, as the entire input range has to be iterated over to find the mean and standard deviation.

  1. ZScore!(T) zScore(T range)
    if (
    isForwardRange!(T) &&
  2. ZScore!(T) zScore(T range, double mean, double sd)