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.

**MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.**

**MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.**

The measures of shape indicate the symmetry and flatness of
the distribution of a data sample. MuPAD^{®} provides the following
functions for calculating the measures of shape:

The

`stats::moment`

function that calculates the`k`

-th momentof the data sample

*x*_{1},*x*_{2},*...*,*x*_{n}centered around`X`

.The

`stats::obliquity`

function that calculates the obliquity (skewness),

where is the arithmetic average (mean) of the data sample

*x*_{1},*x*_{2},*...*,*x*_{n}.The

`stats::kurtosis`

function that calculates the kurtosis (excess),

where is the arithmetic average (mean) of the data sample

*x*_{1},*x*_{2},*...*,*x*_{n}.

The `stats::moment`

function
enables you to compute the `k`

th moment of a data
sample centered around an arbitrary value `X`

. One
of the popular measures in descriptive statistics is a central moment.
The `k`

th central moment of a data sample is the `k`

th
moment centered around the arithmetic average (mean) of that data
sample. The following statements are valid for any data sample:

The zero central moment is always 1.

The first central moment is always 0.

The second central moment is equal to the variance computed by using a divisor

`n`

, rather than`n - 1`

(available via the`Population`

option of`stats::variance`

).

For example, create the lists `L`

and `S`

as
follows:

L := [1, 1, 1, 1, 1, 1, 1, 1, 100.0]: S := [100, 100, 100, 100, 100, 100, 100, 100, 1.0]:

Calculate the arithmetic average of each list by using the `stats::mean`

function:

meanL := stats::mean(L); meanS := stats::mean(S)

Calculate the first four central moments of the list `L`

:

stats::moment(0, meanL, L), stats::moment(1, meanL, L), stats::moment(2, meanL, L), stats::moment(3, meanL, L)

The zero and first central moments are the same for any data
sample. The second central moment is the variance computed with the
divisor `n`

:

stats::variance(L, Population)

Now, calculate the first four central moments of the list `S`

:

stats::moment(0, meanS, S), stats::moment(1, meanS, S), stats::moment(2, meanS, S), stats::moment(3, meanS, S)

Again, the zero central moment is 1, the first central moment
is 0, and the second central moment is the variance computed with
the divisor `n`

:

stats::variance(S, Population)

The obliquity (skewness) is a measure of the symmetry of a distribution.
If the distribution is close to symmetrical around its mean, the value
of obliquity is close to zero. Positive values of obliquity indicate
that the distribution function has a longer tail to the right of the
mean. Negative values indicate that the distribution function has
a longer tail to the left of the mean. For example, calculate the
obliquity of the lists `L`

and `S`

:

stats::obliquity(L); stats::obliquity(S)

The kurtosis measures the flatness of a distribution. For normally distributed data, the kurtosis is zero. Negative kurtosis indicates that the distribution function has a flatter top than the normal distribution. Positive kurtosis indicates that the peak of the distribution function is sharper than it is for the normal distribution:

stats::kurtosis(-2, -1, -0.5, 0, 0.5, 1, 2), stats::kurtosis(-1, 0.5, 0, 0, 0, 0, 0.5, 1)

Was this topic helpful?