Hi all,

   I need to estimate S.E. of a certain indicator. The function to compute the
   value of indicator contains two arguments. Can anybody tell me how to do it?

   Example:
   
   We have data:
   a <- c(1:10)
   b <- c(11:20)
   data <- data.frame(a, b)

   Function to compute value of the indicator:
   indicator <- function(X, Y) sum(X)/(sum(Y)*2)

   Next I need to do the bootstrapping and estimate mean value of indicator and
   its standard error.

   If the function (indicator in my case) contained only one argument, there
   would not  be a problem, the code would look like:

   resamples <- lapply(1:1000, function(i) sample(data, replace = T))
   r.indicator <- sapply(resamples, indicator)
   mean(r.indicator)
   sqrt(var(r.indicator))


   But in case of function with two arguments it doesn’t work. I tried to do 
it
   like:
   resamples <- lapply(1:1000, function(i) data[sample(1:nrow(data), replace =
   TRUE),])
   r.indicator <- sapply(resamples, indicator)

   but it didn't work.


   Can anybody help?

   Thanks a lot.

   Tomas

   __________  Informacia  od  ESET NOD32 Antivirus, verzia databazy 4792
   (20100121) __________
   Tuto spravu preveril ESET NOD32 Antivirus.
   [1]http://www.eset.sk

References

   1. http://www.eset.sk/
______________________________________________
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