Central moment

returns the central moment of `m`

= moment(`X`

,`order`

)`X`

for the order specified by
`order`

.

If

`X`

is a vector, then`moment(X,order)`

returns a scalar value that is the*k*-order central moment of the elements in`X`

.If

`X`

is a matrix, then`moment(X,order)`

returns a row vector containing the*k*-order central moment of each column in`X`

.If

`X`

is a multidimensional array, then`moment(X,order)`

operates along the first nonsingleton dimension of`X`

.

returns the central moment over the dimensions specified in the vector
`m`

= moment(`X`

,`order`

,`vecdim`

)`vecdim`

. For example, if `X`

is a 2-by-3-by-4
array, then `moment(X,1,[1 2])`

returns a 1-by-1-by-4 array. Each
element of the output array is the first-order central moment of the elements on the
corresponding page of `X`

.

The central moment of order *k* for a distribution is defined
as

$${m}_{k}=E{(x-\mu )}^{k},$$

where *µ* is the mean of *x*, and
*E*(*t*) represents the expected value of the
quantity *t*. The `moment`

function computes a sample
version of this population value.

$${m}_{k}=\frac{1}{n}{\displaystyle \sum _{i=1}^{n}{\left({x}_{i}-\overline{x}\right)}^{k}}.$$

Note that the first-order central moment is zero, and the second-order central moment
is the variance computed using a divisor of *n* rather than
*n* – 1, where *n* is the length of the vector
`x`

or the number of rows in the matrix
`X`

.