zscore
Standardized z-scores
Syntax
Description
returns
the z-score for
each element of Z = zscore(X)X such that columns of X are
centered to have mean 0 and scaled to have standard deviation 1. Z is
the same size as X.
If
Xis a vector, thenZis a vector of z-scores.If
Xis a matrix, thenZis a matrix of the same size asX, and each column ofZhas mean 0 and standard deviation 1.For multidimensional arrays, z-scores in
Zare computed along the first nonsingleton dimension ofX.If a column of
Xconsists of identical values, the corresponding values ofZare all zero.
scales Z = zscore(X,flag)X using
the standard deviation indicated by flag.
If
flagis 0 (default), thenzscorescalesXusing the sample standard deviation, with n - 1 in the denominator of the standard deviation formula.zscore(X,0)is the same aszscore(X).If
flagis 1, thenzscorescalesXusing the population standard deviation, with n in the denominator of standard deviation formula.
[ also returns the means and standard deviations used for
centering and scaling, Z,mu,sigma]
= zscore(___)mu and sigma, respectively.
You can use any of the input arguments in the previous syntaxes.
Note
For each column of X that consists of identical values,
zscore returns
sigma=0 and uses a standard deviation of 1
to compute z-scores.
Examples
Input Arguments
Output Arguments
More About
Algorithms
zscore returns NaNs for
any sample containing NaNs.
zscore returns 0s for any sample that is constant (all
values are the same). For example, if X is a vector of the same numeric
value, then Z is a vector of 0s.
Note
The normalize
function returns z-scores that are NaN for any
sample that is constant (all values are the same).
Extended Capabilities
Version History
Introduced before R2006a
See Also
mean | std | normalize | rescale | incrementalNormalizer


