# [S] problem with bootstrap

Feelders A. (A.J.Feelders@kub.nl)
Mon, 15 Jun 1998 09:37:47 MET

Dear S users,

I'm having a problem with the bootstrap. I'm using S-Plus 4.5 with
Windows'95. Basically I want to do the following. I draw a sample
from some theoretical distribution a number of times. Each time I
construct a (1-\alpha)*100% confidence interval for some population
parameter (R^2 in this case), using the bootstrap distribution
constructed from that sample. Then I check the empirical coverage of
these confidence intervals. I wrote the following code to calculate
the confidence limits. For some reason I get the same dataframe z in
each iteration of the for loop! When I remove the lines
"l <- vector("list", length = macro)" and
"l[[i]] <- limits.bca(b[[i]], probs = c(0.1, 0.9))", I do get a
different dataframe z in each iteration, but I can't calculate the
confidence limits outside the function, because limits.bca needs the
original sample. Anybody got a clue what's going on here?

------------------------------------------------------------
wsc.boot <- function(B = 100, macro = 10)
{
b <- vector("list", length = macro)
l <- vector("list", length = macro)
for(i in 1:macro) {
z <- wsc.gen(m = 5) % draw sample from theoretical distribution
b[[i]] <- bootstrap(data=z, statistic=cor(x,y)^2, B=B, group=x)
l[[i]] <- limits.bca(b[[i]], probs = c(0.1, 0.9)) }
list(b = b, l = l)
}

+--------------------------------------------------------------+
| |
| Ad Feelders e-mail: A.J.Feelders@kub.nl |
| Tilburg University Phone: +31 13 466 8201 |
| Faculty of Economics Fax: +31 13 466 3377 |
| PO Box 90153 |
| 5000 LE Tilburg |
| The Netherlands |
| |
+--------------------------------------------------------------+
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news