0
$\begingroup$

I have the following code with the assistance of package "boot", it is very simple so I can learn and you can teach me more effectively:

boot2 <- boot(c(1,2,3,4,5), function(x, i) {return(x[i])}, R=3)
boot2

now some output is:

List of 11
 $ t0       : num [1:5] 1 2 3 4 5
 $ t        : num [1:3, 1:5] 1 2 4 5 5 1 5 2 5 2 ...
 $ R        : num 3
 $ data     : num [1:5] 1 2 3 4 5
 $ seed     : int [1:626] 403 57 1421391679 330754910 842278038 1232799389 1186774653 224981599 -125488798 -1361588607 ...
 $ statistic:function (x, i)  
  ..- attr(*, "srcref")= 'srcref' int [1:8] 1 29 1 57 29 57 1 1
  .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x000000000ac6be78> 
 $ sim      : chr "ordinary"
 $ call     : language boot(data = c(1, 2, 3, 4, 5), statistic = function(x, i) {     return(x[i]) ...
 $ stype    : chr "i"
 $ strata   : num [1:5] 1 1 1 1 1
 $ weights  : num [1:5] 0.2 0.2 0.2 0.2 0.2
 - attr(*, "class")= chr "boot"
 - attr(*, "boot_type")= chr "boot"

Now I understand that boot2\$t0 is the result of performing the desired function on the original input, in the same order. and boot2\$t is that bootstrap of that statistic. eg:

So in this example, I proved c(1,2,3,4,5) as the observed data, and the function I have implemented as the second argument is simply returning each element from the input data vector.

> boot2$t0
[1] 1 2 3 4 5

the output of the function applied to the input observed data

So now I take three bootstrap replicates and they are here:

> boot2$t
     [,1] [,2] [,3] [,4] [,5]
[1,]    1    5    5    2    3
[2,]    2    5    2    1    2
[3,]    4    1    5    1    5

so if I have an estimator say, $\bar{x}$ where x is the original observed data. if I want to find the bias between that the bootstrap samples

1) how do I word that question? for example, is bootstrap samples biased or is the original sample mean biased? Are we making assumptions that one of these two are unbiased in order to establish a bias?

2) how would I do it with this example?

Thanks

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.