Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Standardized * z*-scores

`Z = zscore(X)`

`Z = zscore(X,flag)`

`Z = zscore(X,flag,dim)`

```
[Z,mu,sigma]
= zscore(___)
```

returns
the `Z`

= zscore(`X`

)* z*-score for
each element of

`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, then`Z`

is a vector of-scores.*z*If

`X`

is a matrix, then`Z`

is a matrix of the same size as`X`

, and each column of`Z`

has mean 0 and standard deviation 1.For multidimensional arrays,

-scores in*z*`Z`

are computed along the first nonsingleton dimension of`X`

.

scales `Z`

= zscore(`X`

,`flag`

)`X`

using
the standard deviation indicated by `flag`

.

If

`flag`

is 0 (default), then`zscore`

scales`X`

using the sample standard deviation, with- 1 in the denominator of the standard deviation formula.*n*`zscore(X,0)`

is the same as`zscore(X)`

.If

`flag`

is 1, then`zscore`

scales`X`

using the population standard deviation, within the denominator of standard deviation formula.*n*

`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. If `X`

is a matrix
with a column of consisting of the same value, then that column of `Z`

consists
of `0`

s.

Was this topic helpful?