Documentation

moment

Central moments

Syntax

m = moment(X,order)
moment(X,order,dim)

Description

m = moment(X,order)returns the central sample moment ofXspecified by the positive integerorder. For vectors,moment(x,order)returns the central moment of the specified order for the elements ofx. For matrices,moment(X,order)returns central moment of the specified order for each column. For N-dimensional arrays,momentoperates along the first nonsingleton dimension ofX.

moment(X,order,dim)takes the moment along dimensiondimofX.

Examples

X = randn([6 5]) X = 1.1650 0.0591 1.2460 -1.2704 -0.0562 0.6268 1.7971 -0.6390 0.9846 0.5135 0.0751 0.2641 0.5774 -0.0449 0.3967 0.3516 0.8717 -0.3600 -0.7989 0.7562 -0.6965 -1.4462 -0.1356 -0.7652 0.4005 1.6961 -0.7012 -1.3493 0.8617 -1.3414 m = moment(X,3) m = -0.0282 0.0571 0.1253 0.1460 -0.4486

Tips

Note that the central first moment is zero, and the second central moment is the variance computed using a divisor ofnrather thann– 1, wherenis the length of the vectorxor the number of rows in the matrixX.

The central moment of orderkof a distribution is defined as

m k = E ( x μ ) k

whereE(x) is the expected value ofx.

Extended Capabilities

Introduced before R2006a

Was this topic helpful?