Dataplot Vol 2 Vol 1

# ORDER STATISTICS MEANS

ORDER STATISTICS STANDARD DEVIATIONS

Name:

ORDER STATISTICS MEANS (LET)
ORDER STATISTICS STANDARD DEVIATIONS (LET)
SAVAGE SCORES (LET)
Type:
Let Subcommand
Purpose:
Generate the N order statistics means or order statistic standard deviations from one of the following distributions:

UNIFORM
NORMAL
EXPONENTIAL
Description:
Given a sample of size n from a distribution, the observations can be ordered from smallest to largest. The smallest value is called the first order statistic and the largest value is called the n-th order statistic. There is an order statistic corresponding to each observation (so there are n order statistics in all). Each of these order statistics has its own sampling distribution with its own statistics (e.g., mean, standard deviation).

For the uniform distribution, the order statistic mean and standard deviation are (u denotes the uniform distribution)

$$E(u_{r:n}) = \frac{r} {n+1} \hspace{0.2in} 1 \le r \le n$$

$$SD(u_{r:n}) = \sqrt{\frac{r (n-r+1)} {(n+1)^{2} (n+2)}} \hspace{0.2in} 1 \le r \le n$$

For the exponential distribution, the order statistic mean and standard deviation are (e denotes the exponential distribution)

$$E(e_{r:n}) = \sum_{j=1}^{r}{\frac{1}{n-j+1}} \hspace{0.2in} 1 \le r \le n$$

$$SD(e_{r:n}) = \sum_{j=1}^{r}{\frac{1}{(n-j+1)^{2}}} \hspace{0.2in} 1 \le r \le n$$

A slight variation of the exponential order statistic mean is the Savage score. The Savage score is obtained by subtracting 1 from the exponential order statistic mean. This centers the scores at zero (specifically, the scores sum to zero).

For the normal distribution, the order statistic means are computed numerically using the exact algorithm of Royston for values of n between 2 and 1,999. For n ≥ 2000, the following approximation given by Blom is used (nor denotes the normal distribution)

$$E(nor_{r:n}) = \Phi(\frac{r - \alpha} {n - 2 \alpha + 1}) \hspace{0.2in} 1 \le r \le n$$

where $$\Phi$$ is the cumulative distribution function of the normal distribution and a value of 0.375 is used for $$\alpha$$.

The standard deviation uses the following approximation

$$SD(nor_{r:n}) = \frac{C} {\phi(\Phi(\frac{r}{n+1}^{2}))} \hspace{0.2in} 1 \le r \le n$$

where $$\Phi$$ and $$\phi$$ are the cumulative distribution function and probability density function of the normal distribution, respectively, and

$$C = \frac{r (n-r+1)} {(n+1)^{2} (n+2)}$$

Note that this is a first order approximation. If a more accurate approximation is needed, then this can be computed by a simulation as shown in the Program example below.

Syntax 1:
LET <resp> = <dist> ORDER STATISTICS MEANS
FOR I = <start> <inc> <stop>
where <dist> identifies the distribution from which the order statistics are derived (NORMAL, UNIFORM, EXPONENTIAL);
<start> is a number or parameter that identifies the first row of <resp> in which the order statistics means are saved (typically it has a value of 1);
<inc> is a number or parameter that identifies the row increment of <resp> in which the order statistics means are saved (typically it has a value of 1);
<stop> is a number or parameter that identifies the last row of <resp> in which the order statistics means are saved;
and where <resp> is a variable where the order statistics means are saved.
Syntax 2:
LET <resp> = SAVAGE SCORE FOR I = <start> <inc> <stop>
where <start> is a number or parameter that identifies the first row of <resp> in which the order statistics means are saved (typically it has a value of 1);
<inc> is a number or parameter that identifies the row increment of <resp> in which the Savage scores are saved (typically it has a value of 1);
<stop> is a number or parameter that identifies the last row of <resp> in which the order statistics means are saved;
and where <resp> is a variable where the order statistics means are saved.
Examples:
LET Y1 = NORMAL ORDER STATISTICS MEANS FOR I = 1 1 100
LET Y1 = NORMAL ORDER STATISTICS STANDARD DEVIATIONS FOR I = 1 1 100

LET Y1 = UNIFORM ORDER STATISTICS MEANS FOR I = 1 1 100
LET Y1 = UNIFORM ORDER STATISTICS STANDARD DEVIATIONS FOR I = 1 1 100

LET Y1 = EXPONENTIAL ORDER STATISTICS MEANS FOR I = 1 1 100
LET Y1 = EXPONENTIAL ORDER STATISTICS STANDARD DEVIATIONS FOR I = 1 1 100

Note:
For other distributions you can generate order statistic means and standard deviations via simulation. This is demonstrated in the program example below. This simulation approach can also be applied to other statistics.
Default:
None
Synonyms:
SD is a synonym for STANDARD DEVIATION
EXPONENTIAL SCORES is a synonym for SAVAGE SCORES
Related Commands:
 ORDER STATISTIC MEDIANS = Compute order statistic medeians for a few select distributions. MEAN = Compute the mean of a variable. STANDARD DEVIATION = = Compute the standard deviation of a variable.
Applications:
Extreme value analysis
References:
Royston (1982), "Algorithm AS 177: Expected Normal Order Statistics (Exact and Approximate)," Applied Statistics, 31, pp. 161-165.

Blom (1958), "Statistical Estimates and Transformed Beta Variables," Wiley.

Omondi (2014), "Order Statistics of Uniform, Logistic and Exponential Distributions," Masters Thesis for University Of Nairobi, College of Biological and Physical Sciences, School of Mathematics Chapters 3 and 5.

https://stats.stackexchange.com/questions/394960/ variance-of-normal-order-statistics

Jenny A. Baglivo (2005), "Mathematica laboratories for mathematical statistics: Emphasizing simulation and computer intensive methods."

Higgins (2004), "Introduction to Modern Nonparametric Statisics," Duxbury Press, pp. 50-51.

Implementation Date:
2022/04
2023/05: Added support for SAVAGE SCORES
Program:

. Step 1:   Uniform
.
let n = 50
.
let ymed1  = uniform order statistic medians for i = 1 1 n
let ymean1 = uniform order statistic means   for i = 1 1 n
let ysd1   = uniform order statistic sd      for i = 1 1 n
.
. Step 2:   Exponential
.
let ymed3  = exponential order statistic medians for i = 1 1 n
let ymean3 = exponential order statistic means   for i = 1 1 n
let ysd3   = exponential order statistic sd      for i = 1 1 n
.
. Step 3:   Normal
.
let ymed2  = normal order statistic medians for i = 1 1 n
let ymean2 = normal order statistic means   for i = 1 1 n
let ysd2   = normal order statistic sd      for i = 1 1 n
.
.           Now do simulation
.
let nsamp = 10000
let ynorm = normal rand numbers for i = 1 1 n
let ynorm = sort ynorm
let yunif = uniform rand numbers for i = 1 1 n
let yunif = sort yunif
let yexpo = exponential rand numbers for i = 1 1 n
let yexpo = sort yexpo
let xseq  = sequence 1 1 n
.
feedback off
loop for k = 2 1 nsamp
let ynormt = normal rand numbers for i = 1 1 n
let ynormt = sort ynormt
let yunift = uniform rand numbers for i = 1 1 n
let yunift = sort yunift
let yexpot = exponential rand numbers for i = 1 1 n
let yexpot = sort yexpot
let xseqt  = sequence 1 1 10
let ynorm = combine ynorm ynormt
let yunif = combine yunif yunift
let yexpo = combine yexpo yexpot
let xseq  = combine xseq  xseqt
end of loop
feedback on
.
set let cross tabulate collapse
.
let ymed1b   = cross tabulate median yunif xseq
let ymean1b  = cross tabulate mean   yunif xseq
let ysd1b    = cross tabulate sd     yunif xseq
.
let ymed3b   = cross tabulate median yexpo xseq
let ymean3b  = cross tabulate median yexpo xseq
let ysd3b    = cross tabulate sd     yexpo xseq
.
let ymed2b   = cross tabulate median ynorm xseq
let ymean2b  = cross tabulate mean ynorm xseq
let ysd2b = cross tabulate sd ynorm xseq
.
print "Uniform"
print ymed1 ymean1 ysd1 ymed1b ymean1b ysd1b
print " "
print "Exponential"
print ymed3 ymean3 ysd3 ymed3b ymean3b ysd3b
print " "
print "Normal"
print ymed2 ymean2 ysd2 ymed2b ymean2b ysd2b

The following output is generated

Uniform

------------------------------------------------------------------------------------------
YMED1         YMEAN1           YSD1         YMED1B        YMEAN1B          YSD1B
------------------------------------------------------------------------------------------
0.01377        0.01961        0.01923        0.01375        0.01950        0.01912
0.03341        0.03922        0.02692        0.03332        0.03919        0.02686
0.05326        0.05882        0.03263        0.05309        0.05877        0.03245
0.07312        0.07843        0.03728        0.07238        0.07822        0.03717
0.09297        0.09804        0.04124        0.09241        0.09808        0.04137
0.11283        0.11765        0.04468        0.11256        0.11792        0.04482
0.13268        0.13725        0.04772        0.13198        0.13733        0.04783
0.15254        0.15686        0.05043        0.15204        0.15697        0.05052
0.17239        0.17647        0.05287        0.17199        0.17663        0.05311
0.19225        0.19608        0.05506        0.19154        0.19631        0.05557
0.21210        0.21569        0.05704        0.21205        0.21616        0.05755
0.23196        0.23529        0.05882        0.23224        0.23599        0.05924
0.25181        0.25490        0.06044        0.25265        0.25571        0.06085
0.27167        0.27451        0.06189        0.27244        0.27529        0.06251
0.29152        0.29412        0.06319        0.29245        0.29474        0.06380
0.31138        0.31373        0.06435        0.31203        0.31432        0.06481
0.33123        0.33333        0.06537        0.33271        0.33426        0.06627
0.35109        0.35294        0.06627        0.35219        0.35386        0.06722
0.37094        0.37255        0.06705        0.37200        0.37330        0.06808
0.39080        0.39216        0.06771        0.39175        0.39278        0.06882
0.41065        0.41176        0.06825        0.41159        0.41217        0.06930
0.43051        0.43137        0.06868        0.43087        0.43149        0.06993
0.45036        0.45098        0.06900        0.45045        0.45102        0.07045
0.47022        0.47059        0.06922        0.47031        0.47062        0.07052
0.49007        0.49020        0.06932        0.49022        0.49004        0.07034
0.50993        0.50980        0.06932        0.51072        0.50962        0.07028
0.52978        0.52941        0.06922        0.53030        0.52910        0.07006
0.54964        0.54902        0.06900        0.55042        0.54886        0.06977
0.56949        0.56863        0.06868        0.56947        0.56835        0.06953
0.58935        0.58824        0.06825        0.58936        0.58811        0.06911
0.60920        0.60784        0.06771        0.60847        0.60743        0.06835
0.62906        0.62745        0.06705        0.62851        0.62691        0.06779
0.64891        0.64706        0.06627        0.64832        0.64678        0.06717
0.66877        0.66667        0.06537        0.66864        0.66624        0.06621
0.68862        0.68627        0.06435        0.68821        0.68585        0.06504
0.70848        0.70588        0.06319        0.70858        0.70565        0.06380
0.72833        0.72549        0.06189        0.72795        0.72507        0.06236
0.74819        0.74510        0.06044        0.74834        0.74455        0.06112
0.76804        0.76471        0.05882        0.76802        0.76426        0.05908
0.78790        0.78431        0.05704        0.78767        0.78418        0.05703
0.80775        0.80392        0.05506        0.80815        0.80380        0.05506
0.82761        0.82353        0.05287        0.82793        0.82315        0.05290
0.84746        0.84314        0.05043        0.84805        0.84290        0.05044
0.86732        0.86275        0.04772        0.86774        0.86266        0.04758
0.88717        0.88235        0.04468        0.88754        0.88242        0.04457
0.90703        0.90196        0.04124        0.90752        0.90201        0.04108
0.92688        0.92157        0.03728        0.92717        0.92154        0.03729
0.94674        0.94118        0.03263        0.94717        0.94148        0.03284
0.96659        0.96078        0.02692        0.96692        0.96095        0.02709
0.98623        0.98039        0.01923        0.98608        0.98025        0.01935

Exponential

------------------------------------------------------------------------------------------
YMED3         YMEAN3           YSD3         YMED3B        YMEAN3B          YSD3B
------------------------------------------------------------------------------------------
0.01386        0.02000        0.02000        0.01377        0.01377        0.02011
0.03398        0.04041        0.02857        0.03389        0.03389        0.02849
0.05473        0.06124        0.03536        0.05411        0.05411        0.03517
0.07593        0.08252        0.04127        0.07575        0.07575        0.04100
0.09758        0.10426        0.04665        0.09711        0.09711        0.04635
0.11971        0.12648        0.05167        0.11883        0.11883        0.05158
0.14235        0.14921        0.05645        0.14094        0.14094        0.05621
0.16551        0.17246        0.06105        0.16524        0.16524        0.06076
0.18922        0.19627        0.06553        0.18805        0.18805        0.06517
0.21350        0.22066        0.06992        0.21327        0.21327        0.06952
0.23839        0.24566        0.07425        0.23847        0.23847        0.07414
0.26391        0.27130        0.07856        0.26388        0.26388        0.07877
0.29010        0.29762        0.08285        0.28950        0.28950        0.08310
0.31700        0.32465        0.08714        0.31724        0.31724        0.08713
0.34464        0.35242        0.09146        0.34519        0.34519        0.09093
0.37306        0.38100        0.09582        0.37315        0.37315        0.09536
0.40232        0.41041        0.10024        0.40211        0.40211        0.09990
0.43246        0.44071        0.10472        0.43212        0.43212        0.10426
0.46353        0.47196        0.10928        0.46362        0.46362        0.10900
0.49560        0.50422        0.11394        0.49595        0.49595        0.11386
0.52874        0.53755        0.11872        0.52771        0.52771        0.11863
0.56301        0.57203        0.12362        0.56257        0.56257        0.12431
0.59850        0.60775        0.12868        0.59722        0.59722        0.12918
0.63529        0.64479        0.13390        0.63357        0.63357        0.13407
0.67349        0.68325        0.13932        0.67091        0.67091        0.13962
0.71320        0.72325        0.14495        0.71066        0.71066        0.14436
0.75456        0.76491        0.15082        0.75074        0.75074        0.15001
0.79770        0.80839        0.15696        0.79503        0.79503        0.15661
0.84279        0.85385        0.16341        0.84073        0.84073        0.16343
0.89001        0.90147        0.17020        0.88653        0.88653        0.17023
0.93957        0.95147        0.17740        0.93772        0.93772        0.17663
0.99171        1.00410        0.18504        0.99025        0.99025        0.18441
1.04672        1.05965        0.19320        1.04477        1.04477        0.19252
1.10494        1.11848        0.20196        1.10289        1.10289        0.20130
1.16675        1.18098        0.21141        1.16766        1.16766        0.21156
1.23264        1.24764        0.22167        1.23478        1.23478        0.22067
1.30318        1.31907        0.23289        1.30455        1.30455        0.23274
1.37907        1.39599        0.24527        1.38223        1.38223        0.24450
1.46120        1.47933        0.25904        1.46255        1.46255        0.25731
1.55069        1.57024        0.27453        1.55211        1.55211        0.27340
1.64898        1.67024        0.29217        1.64937        1.64937        0.29103
1.75799        1.78135        0.31259        1.75494        1.75494        0.30994
1.88035        1.90635        0.33665        1.87894        1.87894        0.33576
2.01980        2.04921        0.36571        2.02035        2.02035        0.36380
2.18191        2.21587        0.40190        2.18455        2.18455        0.40057
2.37546        2.41587        0.44891        2.37312        2.37312        0.45048
2.61570        2.66587        0.51383        2.61792        2.61792        0.51354
2.93255        2.99921        0.61248        2.92772        2.92772        0.61419
3.39902        3.49921        0.79065        3.39084        3.39084        0.79425
4.28546        4.49921        1.27481        4.28267        4.28267        1.29448

Normal

------------------------------------------------------------------------------------------
YMED2         YMEAN2           YSD2         YMED2B        YMEAN2B          YSD2B
------------------------------------------------------------------------------------------
-2.20385       -2.24907        0.40384       -2.20508       -2.24905        0.46260
-1.83293       -1.85487        0.31744       -1.83929       -1.85886        0.33922
-1.61402       -1.62863        0.27820       -1.61992       -1.63127        0.29272
-1.45297       -1.46374        0.25457       -1.45691       -1.46531        0.26494
-1.32268       -1.33109        0.23840       -1.32332       -1.33158        0.24628
-1.21163       -1.21845        0.22650       -1.21186       -1.21871        0.23377
-1.11380       -1.11948        0.21731       -1.11716       -1.12009        0.22368
-1.02562       -1.03042        0.20998       -1.02748       -1.03073        0.21614
-0.94476       -0.94887        0.20400       -0.94572       -0.94852        0.20933
-0.86965       -0.87321        0.19903       -0.87063       -0.87472        0.20459
-0.79915       -0.80225        0.19484       -0.80355       -0.80421        0.20051
-0.73242       -0.73513        0.19129       -0.73413       -0.73575        0.19541
-0.66880       -0.67117        0.18825       -0.67042       -0.67280        0.19149
-0.60778       -0.60986        0.18563       -0.60858       -0.61091        0.18934
-0.54894       -0.55077        0.18338       -0.54842       -0.55201        0.18760
-0.49195       -0.49354        0.18145       -0.49110       -0.49473        0.18632
-0.43651       -0.43789        0.17979       -0.43409       -0.43781        0.18373
-0.38239       -0.38357        0.17838       -0.37979       -0.38364        0.18315
-0.32936       -0.33036        0.17718       -0.32947       -0.33115        0.18225
-0.27724       -0.27807        0.17619       -0.27683       -0.27883        0.18117
-0.22587       -0.22653        0.17538       -0.22574       -0.22673        0.18037
-0.17508       -0.17559        0.17475       -0.17548       -0.17590        0.17921
-0.12475       -0.12511        0.17428       -0.12578       -0.12622        0.17907
-0.07472       -0.07494        0.17398       -0.07658       -0.07563        0.17879
-0.02489       -0.02496        0.17382       -0.02586       -0.02560        0.17886
0.02489        0.02496        0.17382        0.02312        0.02429        0.17920
0.07472        0.07494        0.17398        0.07413        0.07463        0.17974
0.12475        0.12511        0.17428        0.12308        0.12466        0.17914
0.17508        0.17559        0.17475        0.17511        0.17571        0.17887
0.22587        0.22653        0.17538        0.22418        0.22627        0.17923
0.27724        0.27807        0.17619        0.27652        0.27788        0.18081
0.32936        0.33036        0.17718        0.32836        0.33009        0.18193
0.38239        0.38357        0.17838        0.37931        0.38398        0.18320
0.43651        0.43789        0.17979        0.43437        0.43794        0.18501
0.49195        0.49354        0.18145        0.49100        0.49319        0.18632
0.54894        0.55077        0.18338        0.54950        0.55152        0.18760
0.60778        0.60986        0.18563        0.60934        0.61013        0.18960
0.66880        0.67117        0.18825        0.66885        0.67125        0.19276
0.73242        0.73513        0.19129        0.73365        0.73491        0.19602
0.79915        0.80225        0.19484        0.79897        0.80088        0.19988
0.86965        0.87321        0.19903        0.87135        0.87252        0.20437
0.94476        0.94887        0.20400        0.94689        0.94798        0.21011
1.02562        1.03042        0.20998        1.02577        1.02968        0.21532
1.11380        1.11948        0.21731        1.11582        1.11874        0.22288
1.21163        1.21845        0.22650        1.21166        1.21622        0.23046
1.32268        1.33109        0.23840        1.31770        1.32633        0.24406
1.45297        1.46374        0.25457        1.45112        1.45975        0.26410
1.61402        1.62863        0.27820        1.60843        1.62305        0.29311
1.83293        1.85487        0.31744        1.83358        1.85170        0.34138
2.20385        2.24907        0.40384        2.21212        2.25416        0.46551

Date created: 04/08/2022
Last updated: 05/18/2023