##
MOMENT

The
MOMENT function computes the
mean,
variance,
skewness, and
kurtosis of a sample
population contained in an *
n*
-element vector *
X*
. If the vector contains ```
n
```

identical elements, MOMENT computes the mean and variance, and returns the IEEE value NaN for the skewness 5and kurtosis, which are not defined. (See
Special Floating-Point Values
.)

When *
x*
= (*
x*
_{
0}
, *
x*
_{
1}
, *
x*
_{
2}
, ..., *
xn*
_{
-1}
), the various moments are defined as follows:

This routine is written in the IDL language. Its source code can be found in the file ```
moment.pro
```

in the ```
lib
```

subdirectory of the IDL distribution.

###
Calling Sequence

Result = MOMENT(*
X*
)

###
Arguments

####
X

An *
n*
-element integer, single-, or double-precision floating-point vector.

###
Keywords

####
DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

####
MDEV

Set this keyword to a named variable that will contain the mean absolute deviation of *
X*
.

####
NAN

Set this keyword to cause the routine to check for occurrences of the IEEE floating-point value NaN in the input data. Elements with the value NaN are treated as missing data. (See
Special Floating-Point Values
for more information on IEEE floating-point values.)

####
SDEV

Set this keyword to a named variable that will contain the standard deviation of *
X*
.

###
Example

Define an *
n*
-element sample population.

X = [65, 63, 67, 64, 68, 62, 70, 66, 68, 67, 69, 71, 66, 65, 70]

Compute the mean, variance, skewness and kurtosis.

result = MOMENT(X)

PRINT, 'Mean: ', result[0] & PRINT, 'Variance: ', result[1] & $

PRINT, 'Skewness: ', result[2] & PRINT, 'Kurtosis: ', result[3]

IDL prints:

Mean: 66.7333

Variance: 7.06667

Skewness: -0.0942851

Kurtosis: -1.18258

###
See Also

,
HISTOGRAM
,
MAX
,
MEAN
,
MEANABSDEV
,
MEDIAN
,
MIN
,
MOMENT
,
STDDEV
,
SKEWNESS
,
VARIANCE