g01ad calculates the mean, standard deviation and coefficients of skewness and kurtosis for data grouped in a frequency distribution.
Syntax
C# |
---|
public static void g01ad( int k, double[] x, int[] ifreq, out double xmean, out double s2, out double s3, out double s4, out int n, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g01ad ( _ k As Integer, _ x As Double(), _ ifreq As Integer(), _ <OutAttribute> ByRef xmean As Double, _ <OutAttribute> ByRef s2 As Double, _ <OutAttribute> ByRef s3 As Double, _ <OutAttribute> ByRef s4 As Double, _ <OutAttribute> ByRef n As Integer, _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g01ad( int k, array<double>^ x, array<int>^ ifreq, [OutAttribute] double% xmean, [OutAttribute] double% s2, [OutAttribute] double% s3, [OutAttribute] double% s4, [OutAttribute] int% n, [OutAttribute] int% ifail ) |
F# |
---|
static member g01ad : k : int * x : float[] * ifreq : int[] * xmean : float byref * s2 : float byref * s3 : float byref * s4 : float byref * n : int byref * ifail : int byref -> unit |
Parameters
- k
- Type: System..::..Int32On entry: , the number of class boundaries, which is one more than the number of classes of the frequency distribution.Constraint: .
- x
- Type: array<System..::..Double>[]()[][]An array of size [k]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 .
- ifreq
- Type: array<System..::..Int32>[]()[][]An array of size [k]On entry: the th element of ifreq must contain the frequency associated with the th class, for . is not used by the method.Constraints:
- , for ;
- .
- xmean
- Type: System..::..Double%On exit: the mean value, .
- s2
- Type: System..::..Double%On exit: the standard deviation, .
- s3
- Type: System..::..Double%On exit: the coefficient of skewness, .
- s4
- Type: System..::..Double%On exit: the coefficient of kurtosis, .
- n
- Type: System..::..Int32%On exit: the total frequency, .
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
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 g01ad 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 method has been developed primarily for groupings of a continuous variable. If, however, the method 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 ,
|
References
None.
Error Indicators and Warnings
Errors or warnings detected by the method:
On entry, .
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.
Accuracy
The method used is believed to be stable.
Parallelism and Performance
None.
Further Comments
The time taken by g01ad increases linearly with .
Example
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 g01ad has been successfully called, the input data and calculated quantities are printed. In the example, there is one set of data, with classes.
Example program (C#): g01ade.cs