randomOrderNormal¶
Generates pseudorandom order statistics from a standard normal distribution.
Synopsis¶
randomOrderNormal (ifirst, ilast, n)
Required Arguments¶
- int
ifirst
(Input) - First order statistic to generate.
- int
ilast
(Input) Last order statistic to generate.
ilast
must be greater than or equal toifirst
. The full set of order statistics fromifirst
toilast
is generated. If only one order statistic is desired, setilast
=ifirst
.- int
n
(Input) - Size of the sample from which the order statistics arise.
Return Value¶
An array of length ilast
+ 1 - ifirst
containing the random order
statistics in ascending order. The first element is the ifirst
order
statistic in a random sample of size n
from the standard normal
distribution.
Description¶
Function randomOrderNormal
generates the ifirst
through the
ilast
order statistics from a pseudorandom sample of size n
from a
normal (0, 1) distribution. Function randomOrderNormal
uses the function
randomOrderUniform
to generate order statistics from the uniform (0, 1)
distribution and then obtains the normal order statistics using the inverse
CDF transformation.
Each call to randomOrderNormal
yields an independent event so order
statistics from different calls may not have the same order relations with
each other.
Example¶
In this example, randomOrderNormal
is used to generate the fifteenth
through the nineteenth order statistics from a sample of size twenty.
from __future__ import print_function
from numpy import *
from pyimsl.stat.randomOrderNormal import randomOrderNormal
from pyimsl.stat.randomSeedSet import randomSeedSet
from pyimsl.stat.writeMatrix import writeMatrix
randomSeedSet(123457)
r = randomOrderNormal(15, 19, 20)
print("The 15th through the 19th order statistics from a \n",
"random sample of size 20 from a normal distribution")
writeMatrix("", r, column=True)
Output¶
The 15th through the 19th order statistics from a
random sample of size 20 from a normal distribution
1 0.4056
2 0.4681
3 0.4697
4 0.9067
5 0.9362