Darwin Help

Back to Index

Zscore

Function Zscore - Test a statistical hypothesis

Calling Sequence  Zscore(data)
ZscorePercent(data)
Parameters
NameTypeDescription

data listCounts of observations, assumed equiprobable
data matrixCounts by two criteria, assumed independent
Return Type  {list,matrix}
Synopsis Zscore transforms a vector or matrix of counts into a vector/matrix of normalized variables (ones with expected value 0 and variance 1). This is subtracting the expected value and dividing by the standard deviation. Or Z = (X-E[X])/sqrt(Var(X)).

In this way the observations can be measured in "standard deviations away from the mean", which is a simple and useful measure. This is sometimes called the Z-transform, but since the Z-transform has a well established use in power series, we use the name Zscore.


If the input is a vector of integers, it is assumed that all the values are counts of events which are equally probable. If the input is a matrix it is assumed that the values are counts of two independent events (columns/rows). In both cases, a binomial distribution is assumed for the counts, i.e. the individual events counted are independent of each other. ZscorePercent is very similar, but instead of returning a normalized variable, it returns a percentage of the expected value, i.e. Z = 100 * (X-E[X])/E[X]

Examples
> Zscore( [8,12,21,7] );
[-1.3333, 0, 3, -1.6667]
> print(Zscore( [[3,7,21],[10,15,33]] ));
 -0.73710648 -0.25050450  0.56887407
  0.55192433  0.19114995 -0.47500296
> ZscorePercent( [8,12,21,7] );
[-33.3333, 0, 75, -41.6667]
See also Cumulative,   CumulativeStd,   OutsideBounds,   ProbBallsBoxes,   ProbCloseMatches,   Rand,   StatTest,   Std_Score,   TestStatResult