Re: Variance estimation by Permutation Samples



****A. G. McDowell said:

***Here's a test example for resampling-based methods. Consider n i.i.d. samples which are 0 with probability p and 1 with probability 1-p. The variance of each sample is therefore p(1-p). With probability 2^-(n-1) all the samples you see will be the same. Consider a method for constructing confidence intervals that is supposed to fail to provide an interval containing the true value with probability less than 2^-(n-1). Feed it n identical values. Does the resulting interval contain the true variance?***


Thank you very much for your mail.
My post is a *scratch*, a previous idea that must be improved. Evidently, the only feature that matters is the true variance must be contained in the CI.
I had to change my primitive algorithm as I show below.
It can be seen that I perform 3 different tests of the single Hypothesis:
Test 1.-The conventional ruled by the Chi-squared distribution.
And the “resampling “
Test 2.- A new one using the MM (modified mean) and MM2 (modified second ordinary moment).
Test 3. – Bootstrap

Because I use as source-sample simulated normal samples X= N(100, 20), I can always check if the Tests 2 and 3, hit or miss the goal: the true variance contained in the CI. Test 1 needs not: a Theorem guarantees that the level of significance is equal to the probability to miss.

Results will arrive soon.
Happy New Year to Everyone

___________licas (Luis A. Afonso)

REM "rubi"
CLS
DIM q(40, 2), has(9002)
INPUT " size (20 or 40) "; size
q(20, 1) = 8.907: q(20, 2) = 32.85
q(40, 1) = 23.654: q(40, 2) = 58.12
cc = size * (size + 1) / 2
DIM x(size), xx(size), z(size)
pi = 4 * ATN(1)
RANDOMIZE TIMER
sum = 0: sq = 0
FOR i = 1 TO size
a = SQR(-2 * LOG(RND)): r = RND
x(i) = 100 + 20 * a * COS(2 * pi * r)
xx(i) = x(i)
sum = sum + x(i)
sq = sq + x(i) * x(i)
NEXT i
sqd = sq - sum * sum / size
vvar = sqd / (size - 1)
PRINT USING " var= ########.# "; vvar
a = sqd / q(size, 1): b = sqd / q(size, 2)
PRINT " Parametric Test : ";
PRINT USING "#######.## "; b; a
PRINT : PRINT "****** ": PRINT
REM "MM"
ALL = 40000
FOR v = 1 TO ALL
LOCATE 8, 50
PRINT USING "############"; ALL - v
RANDOMIZE TIMER
FOR i = 1 TO size: xx(i) = x(i): NEXT i
mm1 = 0: mm2 = 0
FOR j = 1 TO size
1 g = INT(size * RND) + 1
IF xx(g) = 99999 THEN GOTO 1
mm1 = mm1 + j / cc * xx(g)
mm2 = mm2 + j / cc * xx(g) * xx(g)
xx(g) = 99999
NEXT j
x = size * mm2 - size * mm1 * mm1
var = x / (size - 1)
var = INT(var + .5)
has(var) = has(var) + 1
NEXT v
PRINT " MODIFIED "
b(1) = .025 * ALL: b(2) = .975 * ALL
FOR e = 1 TO 2
S = 0
FOR j = 0 TO 9000
S = S + has(j)
IF S > b(e) THEN GOTO 20
NEXT j
20 PRINT j; S / ALL,
NEXT e
FOR k = 0 TO 9002: has(k) = 0: NEXT k
REM BOOTSTRAP
FOR v = 1 TO ALL
LOCATE 10, 50
PRINT USING "############"; ALL - v
RANDOMIZE TIMER
mm1 = 0: mm2 = 0
FOR j = 1 TO size
g = INT(size * RND) + 1
mm1 = mm1 + x(g)
mm2 = mm2 + x(g) * x(g)
NEXT j
x = mm2 - mm1 * mm1 / size
var = x / (size - 1)
var = INT(var + .5)
IF var > 9000 THEN var = 9000
has(var) = has(var) + 1
NEXT v
PRINT " BOOTSTRAP "
b(1) = .025 * ALL: b(2) = .975 * ALL
FOR e = 1 TO 2
S = 0
FOR j = 0 TO 9000
S = S + has(j)
IF S > b(e) THEN GOTO 21
NEXT j
21 PRINT j; S / ALL,
NEXT e: END
.



Relevant Pages

  • Re: The Modernization of Emacs
    ... Michal Nazarewicz schrieb: ... It's nice feature -- I can type whatever I want there. ... also written few functions which preserve content of *scratch* ... buffer between Emacs sessions. ...
    (comp.emacs)
  • Microsoft auto-update feature deleted Excel
    ... Processor: Power PC ... Is this a known feature and do I need to re-install from scratch? ...
    (microsoft.public.mac.office.excel)
  • Re: Public Beta of Castalia 2
    ... >mwEdit reborn from scratch in C# ... >will have this feature. ... Robert Love ...
    (borland.public.delphi.thirdpartytools.general)
  • comment block question
    ... In some of my projects if I have a multi-line comment block I am able to ... collapse those blocks even if it is within a sub or a function. ... feature but I can't seem to recreate it at will. ... the ones I create from scratch don't. ...
    (microsoft.public.dotnet.languages.vb)