
Compute the expected values of order statistics for a random sample from a standard normal distribution.
evNormOrdStats(n = 1,
method = "royston", lower = -9, inc = 0.025, warn = TRUE,
alpha = 3/8, nmc = 2000, seed = 47, approximate = NULL) evNormOrdStatsScalar(r = 1, n = 1,
method = "royston", lower = -9, inc = 0.025, warn = TRUE,
alpha = 3/8, nmc = 2000, conf.level = 0.95, seed = 47, approximate = NULL)
positive integer indicating the sample size.
positive integer between 1
and n
specifying the order statistic
for which to compute the expected value.
character string indicating what method to use. The possible values are:
"royston"
. Method based on approximating the exact integral as
given in Royston (1982).
"blom"
. Method based on the approximation formula proposed by
Blom (1958).
"mc"
. Method based on Monte Carlo simulation.
See the DETAILS section below.
numeric scalar method="royston"
. The upper bound is automatically set
to -lower
. The default value is lower=-9
.
numeric scalar between .Machine$double.eps
and 0.025
that determines
the width of each subdivision used to approximate the integral when
method="royston"
. The default value is inc=0.025
.
logical scalar indicating whether to issue a warning when
method="royston"
and the sample size is greater than 2000.
The default value is warn=TRUE
.
numeric scalar between 0 and 0.5 that determines the constant used when
method="blom"
. The default value is alpha=3/8
.
integer method="mc"
. The default value is nmc=2000
.
numeric scalar between 0 and 1 denoting the confidence level of
the confidence interval for the expected value of the normal
order statistic when method="mc"
.
The default value is conf.level=0.95
.
integer between set.seed
(the random number seed)
when method="mc"
. The default value is seed=47
.
logical scalar included for backwards compatibility with versions of
EnvStats prior to version 2.3.0.
When method
is not supplied and
approximate=FALSE
, method
is set to method="royston"
.
When method
is not supplied and approximate=TRUE
,
method
is set to method="blom"
.
This argument is ignored if method
is supplied and/or
approxmiate=NULL
(the default).
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. When method="mc"
, the returned object also has a
cont.int
attribute that contains the 95
and a nmc
attribute indicating the number of Monte Carlo trials run.
Let mean=0
and sd=1
. That is,
The function evNormOrdStatsScalar
computes the value of
The function evNormOrdStats
computes the values of
Exact Method Based on Royston's Approximation to the Integral (method="royston"
)
When method="royston"
, the integral in Equation (2) above is approximated by
computing the value of the integrand between the values of lower
and
-lower
using increments of inc
, then summing these values and
multiplying by inc
. In particular, the integrand is restructured as:
Note that Equation (1) in Royston (1982) differs from Equations (1) and (2) above
because Royston's paper is based on the
Royston (1982) states that this algorithm “is accurate to at least seven decimal
places on a 36-bit machine,” that it has been validated up to a sample size
of inc
. Note that making
inc
smaller will increase the computation time.
Approxmation Based on Blom's Method (method="blom"
)
When method="blom"
, the following approximation to
Harter (1961) discusses appropriate values of
Approximation Based on Monte Carlo Simulation (method="mc"
)
When method="mc"
, Monte Carlo simulation is used to estmate the expected value
of the nmc
trials are run in which,
for each trial, a random sample of enorm
).
NOTE: This method has not been optimized for large sample sizes n
) and/or a large number of
Monte Carlo trials nmc
) and
may take a long time to execute in these cases.
Blom, G. (1958). Statistical Estimates and Transformed Beta Variables. John Wiley and Sons, New York.
Harter, H. L. (1961). Expected Values of Normal Order Statistics 48, 151--165.
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.
Normal, ppoints
, elnorm3
,
predIntNparSimultaneousTestPower
, gofTest
,
qqPlot
.
# NOT RUN {
# Compute the expected value of the minimum for a random sample of size 10
# from a standard normal distribution:
# Based on method="royston"
#--------------------------
evNormOrdStatsScalar(r = 1, n = 10)
#[1] -1.538753
# Based on method="blom"
#-----------------------
evNormOrdStatsScalar(r = 1, n = 10, method = "blom")
#[1] -1.546635
# Based on method="mc" with 10,000 Monte Carlo trials
#----------------------------------------------------
evNormOrdStatsScalar(r = 1, n = 10, method = "mc", nmc = 10000)
#[1] -1.544318
#attr(,"confint")
# 95%LCL 95%UCL
#-1.555838 -1.532797
#attr(,"nmc")
#[1] 10000
#====================
# Compute the expected values of all of the order statistics
# for a random sample of size 10 from a standard normal distribution
# based on Royston's (1982) method:
#--------------------------------------------------------------------
evNormOrdStats(10)
#[1] -1.5387527 -1.0013570 -0.6560591 -0.3757647 -0.1226678
#[6] 0.1226678 0.3757647 0.6560591 1.0013570 1.5387527
# Compare the above with Blom (1958) scores:
#-------------------------------------------
evNormOrdStats(10, method = "blom")
#[1] -1.5466353 -1.0004905 -0.6554235 -0.3754618 -0.1225808
#[6] 0.1225808 0.3754618 0.6554235 1.0004905 1.5466353
# }
Run the code above in your browser using DataLab