Date: Dec 17, 2012 5:57 PM Author: Luis A. Afonso Subject: “KNOTS”, check sample uniformity ?KNOTS?, check sample uniformity

___n= sample size

__________n=20_____40______60_____80_____100___

_fractile___

__0.005____0.109___0.114___0.114___0.115___0.116__

__0.010____0.118___0.122___0.123___0.123___0.124__

__0.025____0.132___0.136___0.137___0.137___0.138__

__0.050____0.147___0.150___0.151___0.152___0.152__

__0.175____0.158___0.161___0.161___0.162___0.163__

__0.100____0.167___0.170___0.171___0.171___0.171__

__0.200____0.197___0.199___0.200___0.200___0.201__

__0.300____0.223___0.225___0.226___0.226___0.226__

__0.400____0.250___0.252___0.252___0.252___0.253__

__0.500____0.279___0.280___0.281___0.281___0.281__

__0.600____0.312___0.313___0.314___0.314___0.314__

__0.700____0.353___0.354___0.355___0.355___0.355__

__0.800____0.408___0.409___0.409___0.409___0.410__

__0.900____0.497___0.498___0.499___0.499___0.499__

__0.925____0.532___0.532___0.534___0.534___0.534__

__0.950____0.579___0.580___0.580___0.581___0.581__

__0.975____0.655___0.655___0.657___0.657___0.658__

__0.990____0.745___0.747___0.750___0.751___0.750__

__0.995____0.805___0.813___0.814___0.814___0.814__

___Confidence Intervals

__Significance_ 5%___________ 1%_______

__n=20___[0.132, 0.655]___[0.109, 0.805]

____40___[0.136, 0.655]___[0.114, 0.813]

____60___[0.137, 0.657]___[0.114, 0.814]

____80___[0.137, 0.657]___[0.115, 0.814]

___100___[0.138, 0.658]___[0.116, 0.814]

Amazingly the CI bounds for different n are similar and seem to not grow without limit (asymptotic?).

Luis A. Afonso

REM "KNOTS"

REM

CLS

PRINT "0_|__|__|...|__|_1"

PRINT " knots: 1/(2*n), 3/(2*n), ...";

PRINT ",(2*n-3)/(2*n),(2*n-1)/(2*n) "

PRINT "Statistics-->"

PRINT "--> SUM di (j=1, n) = SQR((y(j) - kn(j)) ^ 2 / n)"

INPUT " n= "; n

INPUT " all= "; ali

DIM kn(n), X(n), XX(n), y(n)

DIM w(8001)

DIM u(30)

REM

FOR i = 1 TO n: kn(i) = (2 * i - 1) / (n + n): NEXT i

RANDOMIZE TIMER

FOR rpt = 1 TO ali

LOCATE 6, 50

PRINT USING "##########"; ali - rpt

PRINT : PRINT

FOR u = 1 TO n: X(u) = RND: XX(u) = X(u): NEXT u

FOR u1 = 1 TO n

w = X(u1): p = 1

FOR u2 = 1 TO n

IF XX(u2) < w THEN p = p + 1

NEXT u2

y(p) = w

NEXT u1

w = 0

FOR t = 1 TO n

d = SQR((y(t) - kn(t)) ^ 2 / n)

w = w + d

NEXT t

w = INT(w * 1000 + .5)

w(w) = w(w) + 1

au = rpt / 10000: bu = INT(au)

IF au <> bu THEN GOTO 20

u(1) = .005: u(2) = .01

u(3) = .025: u(4) = .05: u(5) = .075: u(6) = .1

u(7) = .2: u(8) = .3: u(9) = .4

u(10) = .5: u(11) = .6: u(12) = .7: u(13) = .8: u(14) = .9

u(15) = 1 - u(5): u(16) = 1 - u(4): u(17) = 1 - u(3)

u(18) = 1 - u(2): u(19) = 1 - u(1)

REM

FOR y = 1 TO 19

IF y = 1 THEN GOTO 7

IF y / 2 = INT(y / 2) THEN PRINT

7 su = 0: u = u(y)

FOR tt = 0 TO 8000

su = su + w(tt) / rpt

IF su > u THEN GOTO 17

NEXT tt

17 PRINT USING " #.### #.### "; u(y); tt / 1000;

NEXT y

20 NEXT rpt

END