NAG Library Function Document
nag_summary_stats_freq (g01adc) calculates the mean, standard deviation and coefficients of skewness and kurtosis for data grouped in a frequency distribution.
||nag_summary_stats_freq (Integer k,
const double x,
const Integer ifreq,
The input data consist of a univariate frequency distribution, denoted by
, and the boundary values of the classes
. Thus the frequency associated with the interval
, and nag_summary_stats_freq (g01adc) assumes that all the values in this interval are concentrated at the point
The following quantities are calculated:
||coefficient of skewness,
||coefficient of kurtosis,
The function has been developed primarily for groupings of a continuous variable. If, however, the function is to be used on the frequency distribution of a discrete variable, taking the values
, then the boundary values for the classes may be defined as follows:
k – IntegerInput
, the number of class boundaries, which is one more than the number of classes of the frequency distribution.
x[k] – const doubleInput
: the elements of x
must contain the boundary values of the classes in ascending order, so that class
is bounded by the values in
, for .
ifreq[k] – const IntegerInput
th element of ifreq
must contain the frequency associated with the
th class, for
is not used by the function.
- , for ;
xmean – double *Output
On exit: the mean value, .
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, .
n – Integer *Output
On exit: the total frequency, .
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.
Either for some , or the sum of frequencies is zero.
The total frequency is less than .
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, , and .
The method used is believed to be stable.
The time taken by nag_summary_stats_freq (g01adc) increases linearly with .
In the example program, NPROB determines the number of sets of data to be analysed. For each analysis, the boundary values of the classes and the frequencies are read. After nag_summary_stats_freq (g01adc) has been successfully called, the input data and calculated quantities are printed. In the example, there is one set of data, with classes.
9.1 Program Text
Program Text (g01adce.c)
9.2 Program Data
Program Data (g01adce.d)
9.3 Program Results
Program Results (g01adce.r)