NAG Library Function Document
nag_summary_stats_1var (g01aac) calculates the mean, standard deviation, coefficients of skewness and kurtosis, and the maximum and minimum values for a set of ungrouped data. Weighting may be used.
||nag_summary_stats_1var (Integer n,
const double x,
const double wt,
The data consist of a single sample of observations, denoted by , with corresponding weights, , for .
If no specific weighting is required, then each is set to .
The quantities computed are:
||The sum of the weights
||Coefficient of skewness
||Coefficient of kurtosis
||Maximum and minimum elements of the sample.
||The number of observations for which , i.e., the number of valid observations. Suppose observations are valid, then the quantities in (c), (d) and (e) will be computed if , and will be based on degrees of freedom. The other quantities are evaluated provided .
n – IntegerInput
, the number of observations.
x[n] – const doubleInput
On entry: the sample observations, , for .
wt[n] – const doubleInput
: if weights are being supplied then the elements of wt
must contain the weights associated with the observations,
If weights are not supplied then wt
must be set to the null pointer, i.e., (double *)0
nvalid – Integer *Output
: is used to indicate the number of valid observations,
; see Section 3 (g)
xmean – double *Output
On exit: the mean, .
xsd – double *Output
On exit: the standard deviation, .
xskew – double *Output
On exit: the coefficient of skewness, .
xkurt – double *Output
On exit: the coefficient of kurtosis, .
xmin – double *Output
On exit: the smallest value in the sample.
xmax – double *Output
On exit: the largest value in the sample.
wsum – double *Output
: the sum of the weights in the array wt
, that is
This will be
if weighted estimates are not used.
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
On entry, argument had an illegal value.
The number of valid cases is one.
The standard deviation and coefficients of skewness and of kurtosis
cannot be calculated.
The number of valid cases is zero.
On entry, .
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG
On entry, .
The method used is believed to be stable.
The time taken by nag_summary_stats_1var (g01aac) is approximately proportional to .
This example summarises a number of datasets. For each dataset the observations and, optionally, weights are read and printed. nag_summary_stats_1var (g01aac) is then called and the calculated quantities are printed.
9.1 Program Text
Program Text (g01aace.c)
9.2 Program Data
Program Data (g01aace.d)
9.3 Program Results
Program Results (g01aace.r)