zscore
Standardizedz-scores
Syntax
Z = zscore(X)
Z = zscore(X,flag)
Z = zscore(X,flag,dim)
[Z,mu,sigma] = zscore(___)
Description
returns thez-scorefor each element ofZ
= zscore(X
)X
such that columns ofX
are centered to have mean 0 and scaled to have standard deviation 1.Z
is the same size asX
.
If
X
is a vector, thenZ
is a vector ofz-scores.If
X
是矩阵,然后Z
is a matrix of the same size asX
, and each column ofZ
has mean 0 and standard deviation 1.For多维阵列,z-scores in
Z
are computed along thefirst nonsingleton dimensionofX
.
scalesZ
= zscore(X
,flag
)X
using the standard deviation indicated byflag
.
If
flag
是0(默认),然后zscore
scalesX
using the样品标准偏差, withn- 1 in the denominator of the standard deviation formula.zscore(X,0)
is the same aszscore(X)
.If
flag
is 1, thenzscore
scalesX
using thepopulation standard deviation, withnin the denominator of standard deviation formula.
Examples
Input Arguments
Output Arguments
More About
Algorithms
zscore
returnsNaN
s for any sample containingNaN
s.
zscore
returns0
s for any sample that is constant (all values are the same). For example, ifX
is a vector of the same numeric value, thenZ
is a vector of0
s. IfX
is a matrix with a column of consisting of the same value, then that column ofZ
consists of0
s.