NAG Library Function Document
nag_ranks_and_scores (g01dhc)
1 Purpose
nag_ranks_and_scores (g01dhc) computes the ranks, Normal scores, an approximation to the Normal scores or the exponential scores as requested by you.
2 Specification
#include <nag.h> |
#include <nagg01.h> |
void |
nag_ranks_and_scores (Nag_Scores scores,
Nag_Ties ties,
Integer n,
const double x[],
double r[],
NagError *fail) |
|
3 Description
nag_ranks_and_scores (g01dhc) computes one of the following scores for a sample of observations,
.
1. |
Rank Scores
The ranks are assigned to the data in ascending order, that is the th observation has score if it is the th smallest observation in the sample. |
2. |
Normal Scores
The Normal scores are the expected values of the Normal order statistics from a sample of size . If is the th smallest observation in the sample, then the score for that observation, , is where is the th order statistic in a sample of size from a standard Normal distribution and is the expectation operator. |
3. |
Blom, Tukey and van der Waerden Scores
These scores are approximations to the Normal scores. The scores are obtained by evaluating the inverse cumulative Normal distribution function, , at the values of the ranks scaled into the interval using different scaling transformations.
The Blom scores use the scaling transformation for the rank , for . Thus the Blom score corresponding to the observation is
The Tukey scores use the scaling transformation ; the Tukey score corresponding to the observation is
The van der Waerden scores use the scaling transformation ; the van der Waerden score corresponding to the observation is
The van der Waerden scores may be used to carry out the van der Waerden test for testing for differences between several population distributions, see Conover (1980). |
4. |
Savage Scores
The Savage scores are the expected values of the exponential order statistics from a sample of size . They may be used in a test discussed by Savage (1956) and Lehmann (1975). If is the th smallest observation in the sample, then the score for that observation is
where is the th order statistic in a sample of size from a standard exponential distribution and is the expectation operator. |
Ties may be handled in one of five ways. Let
, for
, denote
tied observations, that is
with
. If the rank of
is
, then if ties are ignored the rank of
will be
. Let the scores ignoring ties be
. Then the scores,
, for
, may be calculated as follows:
- – if averages are used, then ;
- – if the lowest score is used, then ;
- – if the highest score is used, then ;
- – if ties are to be broken randomly, then where ;
- – if ties are to be ignored, then .
4 References
Blom G (1958) Statistical Estimates and Transformed Beta-variables Wiley
Conover W J (1980) Practical Nonparametric Statistics Wiley
Lehmann E L (1975) Nonparametrics: Statistical Methods Based on Ranks Holden–Day
Savage I R (1956) Contributions to the theory of rank order statistics – the two-sample case Ann. Math. Statist. 27 590–615
Tukey J W (1962) The future of data analysis Ann. Math. Statist. 33 1–67
5 Arguments
- 1:
– Nag_ScoresInput
-
On entry: indicates which of the following scores are required.
- The ranks.
- The Normal scores, that is the expected value of the Normal order statistics.
- The Blom version of the Normal scores.
- The Tukey version of the Normal scores.
- The van der Waerden version of the Normal scores.
- The Savage scores, that is the expected value of the exponential order statistics.
Constraint:
, , , , or .
- 2:
– Nag_TiesInput
-
On entry: indicates which of the following methods is to be used to assign scores to tied observations.
- The average of the scores for tied observations is used.
- The lowest score in the group of ties is used.
- The highest score in the group of ties is used.
- The repeatable random number generator is used to randomly untie any group of tied observations.
- Any ties are ignored, that is the scores are assigned to tied observations in the order that they appear in the data.
Constraint:
, , , or .
- 3:
– IntegerInput
-
On entry: , the number of observations.
Constraint:
.
- 4:
– const doubleInput
-
On entry: the sample of observations,
, for .
- 5:
– doubleOutput
-
On exit: contains the scores,
, for
, as specified by
scores.
- 6:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
6 Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 3.2.1.2 in the Essential Introduction for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_INT_ARG_LT
-
On entry, .
Constraint: .
- NE_INTERNAL_ERROR
-
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
An unexpected error has been triggered by this function. Please contact
NAG.
See
Section 3.6.6 in the Essential Introduction for further information.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 3.6.5 in the Essential Introduction for further information.
7 Accuracy
For , the results should be accurate to machine precision.
For , the results should be accurate to a small multiple of machine precision.
For , the results should have a relative accuracy of at least where is the machine precision.
For , or , the results should have a relative accuracy of at least .
8 Parallelism and Performance
nag_ranks_and_scores (g01dhc) 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 function. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
If more accurate Normal scores are required
nag_normal_scores_exact (g01dac) should be used with appropriate settings for the input argument
etol.
10 Example
This example computes and prints the Savage scores for a sample of five observations. The average of the scores of any tied observations is used.
10.1 Program Text
Program Text (g01dhce.c)
10.2 Program Data
Program Data (g01dhce.d)
10.3 Program Results
Program Results (g01dhce.r)