NAG Library Routine Document
G01ADF calculates the mean, standard deviation and coefficients of skewness and kurtosis for data grouped in a frequency distribution.
||K, IFREQ(K), N, IFAIL
||X(K), XMEAN, S2, S3, S4
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 G01ADF 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 routine has been developed primarily for groupings of a continuous variable. If, however, the routine 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:
- 1: K – INTEGERInput
On entry: , the number of class boundaries, which is one more than the number of classes of the frequency distribution.
- 2: X(K) – REAL (KIND=nag_wp) arrayInput
: 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 .
- 3: IFREQ(K) – INTEGER arrayInput
th element of IFREQ
must contain the frequency associated with the
th class, for
is not used by the routine.
- , for ;
- 4: XMEAN – REAL (KIND=nag_wp)Output
On exit: the mean value, .
- 5: S2 – REAL (KIND=nag_wp)Output
On exit: the standard deviation, .
- 6: S3 – REAL (KIND=nag_wp)Output
On exit: the coefficient of skewness, .
- 7: S4 – REAL (KIND=nag_wp)Output
On exit: the coefficient of kurtosis, .
- 8: N – INTEGEROutput
On exit: the total frequency, .
- 9: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Errors or warnings detected by the routine:
|On entry,||the boundary values of the classes in X are not in ascending order.|
|On entry,|| or for some , for .|
The total frequency, , is less than , hence the quantities , and cannot be calculated.
The method used is believed to be stable.
The time taken by G01ADF 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 G01ADF 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 (g01adfe.f90)
9.2 Program Data
Program Data (g01adfe.d)
9.3 Program Results
Program Results (g01adfe.r)