The routine may be called by the names g07daf or nagf_univar_robust_1var_median.
The data consists of a sample of size , denoted by , drawn from a random variable .
g07daf first computes the median,
and from this the median absolute deviation can be computed,
Finally, a robust estimate of the standard deviation is computed,
where is the value of the inverse standard Normal function at the point .
g07daf is based upon subroutine LTMDDV within the ROBETH library, see Marazzi (1987).
Huber P J (1981) Robust Statistics Wiley
Marazzi A (1987) Subroutines for robust estimation of location and scale in ROBETH Cah. Rech. Doc. IUMSP, No. 3 ROB 1 Institut Universitaire de Médecine Sociale et Préventive, Lausanne
1: – IntegerInput
On entry: , the number of observations.
2: – Real (Kind=nag_wp) arrayInput
On entry: the vector of observations, .
3: – Real (Kind=nag_wp) arrayOutput
On exit: the observations sorted into ascending order.
4: – Real (Kind=nag_wp)Output
On exit: the median, .
5: – Real (Kind=nag_wp)Output
On exit: the median absolute deviation, .
6: – Real (Kind=nag_wp)Output
On exit: the robust estimate of the standard deviation, .
7: – 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, .
An unexpected error has been triggered by this routine. Please
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.
The computations are believed to be stable.
8Parallelism and Performance
g07daf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
g07daf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
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.
Unless otherwise stated in the Users' Note, the routine may be called with the same actual array supplied for arguments x and y, in which case the sorted data values will overwrite the original contents of x. However this is not standard Fortran, and may not work on all systems.
The following program reads in a set of data consisting of eleven observations of a variable . The median, median absolute deviation and a robust estimate of the standard deviation are calculated and printed along with the sorted data in output array y.