nag_summary_stats_freq (g01adc) calculates the mean, standard deviation and coefficients of skewness and kurtosis for data grouped in a frequency distribution.
The input data consist of a univariate frequency distribution, denoted by
, for
, and the boundary values of the classes
, for
. Thus the frequency associated with the interval
is
, and nag_summary_stats_freq (g01adc) assumes that all the values in this interval are concentrated at the point
The following quantities are calculated:
(a) |
total frequency,
|
(b) |
mean,
|
(c) |
standard deviation,
|
(d) |
coefficient of skewness,
|
(e) |
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:
(i) |
for ,
|
(ii) |
for ,
|
None.
- 1:
k – IntegerInput
On entry: , the number of class boundaries, which is one more than the number of classes of the frequency distribution.
Constraint:
.
- 2:
x[k] – const doubleInput
On entry: the elements of
x must contain the boundary values of the classes in ascending order, so that class
is bounded by the values in
and
, for
.
Constraint:
, for .
- 3:
ifreq[k] – const IntegerInput
On entry: the
th element of
ifreq must contain the frequency associated with the
th class, for
.
is not used by the function.
Constraints:
- , for ;
- .
- 4:
xmean – double *Output
On exit: the mean value, .
- 5:
xsd – double *Output
On exit: the standard deviation, .
- 6:
xskew – double *Output
On exit: the coefficient of skewness, .
- 7:
xkurt – double *Output
On exit: the coefficient of kurtosis, .
- 8:
n – Integer *Output
On exit: the total frequency, .
- 9:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
The method used is believed to be stable.
Not applicable.
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.