Hello,  I'm not much of a programmer, and am trying to understand the workings 
of the function below called "RStatFctn" within this bootstrap procedure.  

RStatFctn is defined to have two arguments: "x", intended to be a data vector; 
and "d" intended to be an index (or so it looks to me).
Later, "rnormdat" is created to be the data vector.   However, when RStatFctn 
is called within the bootstrap function, I don't see where "rnormdat" is 
explicitly passed to RStatFctn as the data vector "x".  And I don't see where 
any values are ever passed to the index variable "d", or where any index is 
ever referenced or used in conjunction with RStatFctn.

Any help you can offer is appreciated.

Thanks, Paul

library(boot)

RStatFctn <- function(x,d) {return(mean(x[d]))}

b.basic = matrix(data=NA, nrow=1000, ncol=2) b.normal = matrix(data=NA, 
nrow=1000, ncol=2) b.percent =matrix(data=NA, nrow=1000, ncol=2) b.bca 
=matrix(data=NA, nrow=1000, ncol=2)

for(i in 1:1000){
rnormdat = rnorm(30,0,1)
b <- boot(rnormdat, RStatFctn, R = 1000) b.ci=boot.ci(b, conf 
=0.95,type=c("basic","norm","perc","bca"))
b.basic[i,] = b.ci$basic[,4:5]
b.normal[i,] = b.ci$normal[,2:3]
b.percent[i,] = b.ci$percent[,4:5]
b.bca[i,] = b.ci$bca[,4:5]
} 

Paul Prew   ▪  Statistician
651-795-5942   ▪   fax 651-204-7504 
Ecolab Research Center   ▪  Mail Stop ESC-F4412-A 
655 Lone Oak Drive   ▪   Eagan, MN 55121-1560 


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to