Access the values given by the "boot"

3

I'm having a problem getting some values given by the boot function in the R:

My data

dados<- c(16483.82, 16463.06, 15649.35, 15615.27, 20034.44, 16254.43, 16946.72)
meanFunc <- function(x,i){mean(x[i])}
 bootMean <-(boot(data=x,statistic=meanFunc,R=1000))

After this, I do > bootMean and the result is as follows:

ORDINARY NONPARAMETRIC BOOTSTRAP

Call:
boot(data = x, statistic = meanFunc, R = 1000)

Bootstrap Statistics :

    original        bias     std. error
t1* 16778.16  -0.9335903     540.371

I've taken some of these codes this link

I tried to convert to a date frame but it did not work.

    
asked by anonymous 04.02.2015 / 21:44

2 answers

1

I found a possible solution here , so if someone has the same problem a way to solve and this.

bias<- mean(bootMean$t) - bootMean$t0    
desviopadrao<- sd(bootMean$t)

original<-bootMean$t0
    
05.02.2015 / 11:15
0

1) If you want to know the content of an object (and therefore the fields) the solution is to use str

> str(bootMean)
List of 11
 $ t0       : num 16778
 $ t        : num [1:1000, 1] 16692 17501 16776 17648 16184 ...
 $ R        : num 1000
 $ data     : num [1:7] 16484 16463 15649 15615 20034 ...
 $ seed     : int [1:626] 403 1 235491040 177295907 312278337 450969648 1593694798 259661497 1711303371 -2124436614 ...
 $ statistic:function (x, i)  
  ..- attr(*, "srcref")=Class 'srcref'  atomic [1:8] 1 13 1 37 13 37 1 1
  .. .. ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment:0x102c7ce28> 
 $ sim      : chr "ordinary"
 $ call     : language boot(data = dados, statistic = meanFunc, R = 1000)
 $ stype    : chr "i"
 $ strata   : num [1:7] 1 1 1 1 1 1 1
 $ weights  : num [1:7] 0.143 0.143 0.143 0.143 0.143 ...
 - attr(*, "class")= chr "boot"

2) I use boot in conjunction with boot.ci to get the confidence interval (the tchans of a method like bootstrap is not getting the media - which should be very similar to the average obtained with mean , but rather the confidence interval).

But getting the results of boot.ci is not straightforward, you need to read the value of the manual link

> bci<-boot.ci(bootMean)
Warning message:
In boot.ci(bootMean) : bootstrap variances needed for studentized intervals
> bci$bca[4:5]
[1] 16074.65 18516.44
    
13.02.2015 / 07:56