The routine may be called by the names g07ddf or nagf_univar_robust_1var_trimmed.
3Description
g07ddf calculates the -trimmed mean and -Winsorized mean for a given , as described below.
Let , for represent the sample observations sorted into ascending order. Let where represents the integer nearest to ; if then is reduced by .
Then the trimmed mean is defined as:
and the Winsorized mean is defined as:
g07ddf then calculates the Winsorized variance about the trimmed and Winsorized means respectively and divides by to obtain estimates of the variances of the above two means.
Thus we have;
and
4References
Hampel F R, Ronchetti E M, Rousseeuw P J and Stahel W A (1986) Robust Statistics. The Approach Based on Influence Functions Wiley
Huber P J (1981) Robust Statistics Wiley
5Arguments
1: – IntegerInput
On entry: , the number of observations.
Constraint:
.
2: – Real (Kind=nag_wp) arrayInput
On entry: the sample observations,
, for .
3: – Real (Kind=nag_wp)Input
On entry: , the proportion of observations to be trimmed at each end of the sorted sample.
Constraint:
.
4: – Real (Kind=nag_wp)Output
On exit: the -trimmed mean, .
5: – Real (Kind=nag_wp)Output
On exit: the -Winsorized mean, .
6: – Real (Kind=nag_wp)Output
On exit: contains an estimate of the variance of the trimmed mean.
7: – Real (Kind=nag_wp)Output
On exit: contains an estimate of the variance of the Winsorized mean.
8: – IntegerOutput
On exit: contains the number of observations trimmed at each end, .
9: – Real (Kind=nag_wp) arrayOutput
On exit: contains the sample observations sorted into ascending order.
10: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
Constraint: .
On entry, .
Constraint: .
An unexpected error has been triggered by this routine. Please
contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
7Accuracy
The results should be accurate to within a small multiple of machine precision.
8Parallelism and Performance
g07ddf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
The time taken is proportional to .
10Example
The following program finds the -trimmed mean and -Winsorized mean for a sample of observations where . The estimates of the variances of the above two means are also calculated.