PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_stat_withdraw_summary_1var (g01aa)
Purpose
nag_stat_summary_1var (g01aa) 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.
Note: this function is scheduled to be withdrawn, please see
g01aa in
Advice on Replacement Calls for Withdrawn/Superseded Routines..
Syntax
[
xmean,
s2,
s3,
s4,
xmin,
xmax,
iwt,
wtsum,
ifail] = g01aa(
x, 'n',
n, 'wt',
wt)
[
xmean,
s2,
s3,
s4,
xmin,
xmax,
iwt,
wtsum,
ifail] = nag_stat_withdraw_summary_1var(
x, 'n',
n, 'wt',
wt)
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 23: |
wt is no longer an output parameter; output parameters were reordered |
Description
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:
(a) |
The sum of the weights
|
(b) |
Mean
|
(c) |
Standard deviation
|
(d) |
Coefficient of skewness
|
(e) |
Coefficient of kurtosis
|
(f) |
Maximum and minimum elements of the sample. |
(g) |
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 . |
References
None.
Parameters
Compulsory Input Parameters
- 1:
– double array
-
The sample observations,
, for .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
x,
wt. (An error is raised if these dimensions are not equal.)
, the number of observations.
Constraint:
.
- 2:
– double array
-
If the user wishes to supply weights then the elements of
wt must contain the weights associated with the observations,
, for
.
Output Parameters
- 1:
– double scalar
-
The mean, .
- 2:
– double scalar
-
The standard deviation, .
- 3:
– double scalar
-
The coefficient of skewness, .
- 4:
– double scalar
-
The coefficient of kurtosis, .
- 5:
– double scalar
-
The smallest value in the sample.
- 6:
– double scalar
-
The largest value in the sample.
- 7:
– int64int32nag_int scalar
-
iwt is used to indicate the number of valid observations,
; see
(g) in
Description above.
- 8:
– double scalar
-
The sum of the weights in the array
wt, that is
. This will be
n if
iwt was
on entry.
- 9:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
- W
-
The number of valid cases, , is . In this case, standard deviation and coefficients of skewness and of kurtosis cannot be calculated.
-
-
Either the number of valid cases is , or at least one weight is negative.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
The method used is believed to be stable.
Further Comments
The time taken by nag_stat_summary_1var (g01aa) is approximately proportional to .
Example
This example summarises an (optionally weighted) dataset and displays the results.
Open in the MATLAB editor:
g01aa_example
function g01aa_example
fprintf('g01aa example results\n\n');
x = [193 216 112 161 92 140 38 33 ...
279 249 473 339 60 130 20 50 ...
257 284 447 52 67 61 150 2200];
n = size(x,2);
[xmean, s2, s3, s4, xmin, xmax, iwt, wtsum, ifail] = ...
g01aa(x);
fprintf('Number of cases %7d\n',n);
fprintf('Data as input -\n');
fprintf('%12.1f%12.1f%12.1f%12.1f%12.1f\n',x)
fprintf('\n\n');
fprintf('No. of valid cases %7d\n',iwt);
fprintf('Mean %7.1f\n',xmean);
fprintf('Minimum %7.1f\n',xmin);
fprintf('Maximum %7.1f\n',xmax);
fprintf('Sum of weights %7.1f\n',wtsum);
fprintf('Std devn %7.1f\n',s2);
fprintf('Skewness %7.1f\n',s3);
fprintf('Kurtosis %7.1f\n',s4);
g01aa example results
Number of cases 24
Data as input -
193.0 216.0 112.0 161.0 92.0
140.0 38.0 33.0 279.0 249.0
473.0 339.0 60.0 130.0 20.0
50.0 257.0 284.0 447.0 52.0
67.0 61.0 150.0 2200.0
No. of valid cases 24
Mean 254.3
Minimum 20.0
Maximum 2200.0
Sum of weights 24.0
Std devn 433.5
Skewness 3.9
Kurtosis 14.7
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015