# evNormOrdStats

##### Expected Value of Order Statistics from Random Sample from Standard Normal Distribution

Compute the expected value of order statistics from a random sample from a standard normal distribution.

- Keywords
- distribution

##### Usage

```
evNormOrdStats(n = 1, approximate = FALSE)
evNormOrdStatsScalar(r = 1, n = 1, approximate = FALSE)
```

##### Arguments

- n
- positive integer indicating the sample size.
- r
- positive integer between
`1`

and`n`

specifying the order statistic for which to compute the expected value. - approximate
- logical scalar indicating whether to use the Blom score approximation (Blom, 1958).
The default value is
`FALSE`

.

##### Details

Let $\underline{z} = z_1, z_2, \ldots, z_n$ denote a vector of $n$
observations from a normal distribution with parameters
`mean=0`

and `sd=1`

. That is, $\underline{z}$ denotes a vector of
$n$ observations from a *standard* normal distribution. Let
$z_{(r)}$ denote the $r$'th order statistic of $\underline{z}$,
for $r = 1, 2, \ldots, n$. The probability density function of
$z_{(r)}$ is given by:
$$f_{r,n}(t) = \frac{n!}{(r-1)!(n-r)!} [\Phi(t)]^{r-1} [1 - \Phi(t)]^{n-r} \phi(t) \;\;\;\;\;\; (1)$$
where $\Phi$ and $\phi$ denote the cumulative distribution function and
probability density function of the standard normal distribution, respectively
(Johnson et al., 1994, p.93). Thus, the expected value of $z_{(r)}$ is given by:
$$E(r, n) = E[z_{(r)}] = \int_{-\infty}^{\infty} t f_{r,n}(t) dt \;\;\;\;\;\; (2)$$
It can be shown that if $n$ is odd, then
$$E[(n+1)/2, n] = 0 \;\;\;\;\;\; (3)$$
Also, for all values of $n$,
$$E(r, n) = -E(n-r, n) \;\;\;\;\;\; (4)$$
The function `evNormOrdStatsScalar`

computes the value of $E(r,n)$ for
user-specified values of $r$ and $n$.
The function `evNormOrdStats`

computes the values of $E(r,n)$ for all
values of $r$ for a user-specified value of $n$.
For large values of $n$, the function `evNormOrdStats`

with
`approximate=FALSE`

may take a long time to execute. When
`approximate=TRUE`

, `evNormOrdStats`

and `evNormOrdStatsScalar`

use the following approximation to $E(r,n)$, which was proposed by
Blom (1958, pp. 68-75):
$$E(r, n) \approx \Phi^{-1}(\frac{r - 3/8}{n + 1/4}) \;\;\;\;\;\; (5)$$
This approximation is quite accurate. For example, for $n \ge 2$, the
approximation is accurate to the first decimal place, and for $n \ge 9$ it
is accurate to the second decimal place.

##### Value

- For
`evNormOrdStats`

: a numeric vector of length`n`

containing the expected values of all the order statistics for a random sample of`n`

standard normal deviates. For`evNormOrdStatsScalar`

: a numeric scalar containing the expected value of the`r`

'th order statistic from a random sample of`n`

standard normal deviates.

##### Note

The expected values of normal order statistics are used to construct normal
quantile-quantile (Q-Q) plots (see `qqPlot`

) and to compute
goodness-of-fit statistics (see `gofTest`

). Usually, however,
approximations are used instead of exact values. The functions
`evNormOrdStats`

and `evNormOrdStatsScalar`

have been included mainly
because `evNormOrdStatsScalar`

is called by `elnorm3`

and `predIntNparSimultaneousTestPower`

.

##### References

Johnson, N. L., S. Kotz, and N. Balakrishnan. (1994).
*Continuous Univariate Distributions, Volume 1*.
Second Edition. John Wiley and Sons, New York, pp. 93--99.
Royston, J.P. (1982). Algorithm AS 177. Expected Normal Order Statistics
(Exact and Approximate). *Applied Statistics* **31**, 161--165.

##### See Also

Normal, `elnorm3`

,
`predIntNparSimultaneousTestPower`

, `gofTest`

,
`qqPlot`

.

##### Examples

```
# Compute the expected value of the minimum for a random sample of size 10
# from a standard normal distribution:
evNormOrdStatsScalar(r = 1, n = 10)
#[1] -1.538753
#----------
# Compute the expected values of all of the order statistics for a random sample
# of size 10 from a standard normal distribution:
evNormOrdStats(10)
#[1] -1.5387527 -1.0013570 -0.6560591 -0.3757647 -0.1226888
#[6] 0.1226888 0.3757647 0.6560591 1.0013570 1.5387527
# Compare the above with Blom (1958) scores:
evNormOrdStats(10, approx = TRUE)
#[1] -1.5466353 -1.0004905 -0.6554235 -0.3754618 -0.1225808
#[6] 0.1225808 0.3754618 0.6554235 1.0004905 1.5466353
```

*Documentation reproduced from package EnvStats, version 2.1.0, License: GPL (>= 3)*