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
X
is a vector, thenZ
is a vector of z-scores.If
X
is a matrix, thenZ
is a matrix of the same size asX
, and each column ofZ
has mean 0 and standard deviation 1.For multidimensional arrays, z-scores in
Z
are computed along the first nonsingleton dimension ofX
.
scales Z
= zscore(X
,flag
)X
using
the standard deviation indicated by flag
.
If
flag
is 0 (default), thenzscore
scalesX
using the sample standard deviation, with n - 1 in the denominator of the standard deviation formula.zscore(X,0)
is the same aszscore(X)
.If
flag
is 1, thenzscore
scalesX
using the population standard deviation, with n in the denominator of standard deviation formula.
Examples
Input Arguments
Output Arguments
More About
Algorithms
zscore
returns NaN
s for
any sample containing NaN
s.
zscore
returns 0
s 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 0
s.
Extended Capabilities
Version History
Introduced before R2006a