Re: Variance estimation by Permutation Samples
- From: "\"Luis A. Afonso\"" <licas_@xxxxxxxxxxx>
- Date: Fri, 30 Dec 2005 07:41:11 EST
****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
.
- References:
- Variance estimation by Permutation Samples
- From: \"Luis A. Afonso\"
- Variance estimation by Permutation Samples
- Prev by Date: Re: About ACF Plot in S+
- Next by Date: Re: Solutions - Statistical Inference Casella & Berger
- Previous by thread: Re: Variance estimation by Permutation Samples
- Next by thread: Re: Variance estimation by Permutation Samples
- Index(es):
Relevant Pages
|
|