Moment

Advanced Analysis Library Only

AnalysisLibErrType Moment (double inputArray[], int numberOfElements, int order, double *moment);

Purpose

Calculates the moment about the mean of the input array with the specified order. Moment uses the following formulas to find the moment:


where

Example

/* Generate an array with random numbers and determine its skewness (third-order moment) and its kurtosis (fourth-order moment). */
double x[200], skew, kurtosis;
n, order;
n = 200;
Uniform (n, 17, x);
order = 3;
Moment (x, n, order, &skew);
order = 4;
Moment (x, n, order, &kurtosis);

Parameters

Input
Name Type Description
inputArray double-precision array Input array used to compute the moment about the mean.
numberOfElements integer Number of elements used to compute the moment about the mean.
order integer Moment order.

Note    order must be greater than zero. If this value is less than zero, Moment returns an error code and does not calculate the mean.

Default Value: 3.
Output
Name Type Description
moment double-precision Moment about the mean.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.