NAG Library Function Document
nag_rank_ci_1var (g07eac) computes a rank based (nonparametric) estimate and confidence interval for the location argument of a single population.
||nag_rank_ci_1var (Nag_RCIMethod method,
const double x,
Consider a vector of independent observations,
with unknown common symmetric density
. nag_rank_ci_1var (g07eac) computes the Hodges–Lehmann location estimator (see Lehmann (1975)
) of the centre of symmetry
, together with an associated confidence interval. The Hodges–Lehmann estimate is defined as
- if is odd, where ;
- if is even, where .
This estimator arises from inverting the one-sample Wilcoxon signed-rank test statistic,
, for testing the hypothesis that
is a monotonically decreasing step function of
is the solution to the equation
; two methods are available for solving this equation. These methods avoid the computation of all the ordered averages
; this is because for large
both the storage requirements and the computation time would be excessive.
The first is an exact method based on a set partitioning procedure on the set of all ordered averages
. This is based on the algorithm proposed by Monahan (1984)
The second is an iterative algorithm, based on the Illinois method which is a modification of the regula falsi
method, see McKean and Ryan (1977)
. This algorithm has proved suitable for the function
which is asymptotically linear as a function of
The confidence interval limits are also based on the inversion of the Wilcoxon test statistic.
Given a desired percentage for the confidence interval,
, expressed as a proportion between
, initial estimates for the lower and upper confidence limits of the Wilcoxon statistic are found from
is the inverse cumulative Normal distribution function.
are rounded to the nearest integer values. These estimates are then refined using an exact method if
, and a Normal approximation otherwise, to find
. This is the largest value
Let ; then . This is the smallest value such that .
As in the case of , these equations may be solved using either the exact or the iterative methods to find the values and .
Then is the confidence interval for . The confidence interval is thus defined by those values of such that the null hypothesis, , is not rejected by the Wilcoxon signed-rank test at the level.
Lehmann E L (1975) Nonparametrics: Statistical Methods Based on Ranks Holden–Day
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
McKean J W and Ryan T A (1977) Algorithm 516: An algorithm for obtaining confidence intervals and point estimates based on ranks in the two-sample location problem ACM Trans. Math. Software 10 183–185
Monahan J F (1984) Algorithm 616: Fast computation of the Hodges–Lehman location estimator ACM Trans. Math. Software 10 265–270
method – Nag_RCIMethodInput
: specifies the method to be used.
- The exact algorithm is used.
- The iterative algorithm is used.
n – IntegerInput
On entry: , the sample size.
x[n] – const doubleInput
On entry: the sample observations,
, for .
clevel – doubleInput
: the confidence interval desired.
For example, for a confidence interval set .
theta – double *Output
On exit: the estimate of the location, .
thetal – double *Output
On exit: the estimate of the lower limit of the confidence interval, .
thetau – double *Output
On exit: the estimate of the upper limit of the confidence interval, .
estcl – double *Output
On exit: an estimate of the actual percentage confidence of the interval found, as a proportion between .
wlower – double *Output
On exit: the upper value of the Wilcoxon test statistic, , corresponding to the lower limit of the confidence interval.
wupper – double *Output
On exit: the lower value of the Wilcoxon test statistic, , corresponding to the upper limit of the confidence interval.
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
Dynamic memory allocation failed.
On entry, argument had an illegal value.
Warning. The iterative procedure to find an estimate of the lower confidence point had not converged in iterations.
Warning. The iterative procedure to find an estimate of Theta had not converged in iterations.
Warning. The iterative procedure to find an estimate of the upper confidence point had not converged in iterations.
On entry, .
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
On entry, clevel
is out of range:
Not enough information to compute an interval estimate since the whole sample is identical. The common value is returned in theta
nag_rank_ci_1var (g07eac) should produce results accurate to five significant figures in the width of the confidence interval; that is the error for any one of the three estimates should be less than .
8 Parallelism and Performance
nag_rank_ci_1var (g07eac) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the Users' Note
for your implementation for any additional implementation-specific information.
The time taken increases with the sample size .
The following program calculates a 95% confidence interval for , a measure of symmetry of the sample of observations.
10.1 Program Text
Program Text (g07eace.c)
10.2 Program Data
Program Data (g07eace.d)
10.3 Program Results
Program Results (g07eace.r)