[R] function in boot

YIHSU CHEN yschen at jhu.edu
Thu Jun 29 16:26:29 CEST 2006


Dear R users:

I'm trying to use "boot" function under the package boot to run some bootstrapping.

Basically, I have a df as follows. (The data is simplified for illustrative purpose.) 

V1 V2 V3
1  2  3 
4  5  7
3  5  2

Say that I want bootrap among (V1,V2,V3) for 1000 times and calculate the average of them, ie., v_bar still has lenght of 3. I think my question is really how to write bf function below. 

bf <- function(d,f)
{
    gp1 <- 1:3 #indicate random draw from three series
    dmean <- apply(d[,gp1]*f[gp1],1,mean)      
}
a <- boot(df,bf, R=1000, stype="f")


Any help or suggestions? Many thanks.

Yihsu



More information about the R-help mailing list