[R] Extracting components from a 'boot' class output in R

Tim Hesterberg timhesterberg at gmail.com
Mon Jul 25 07:11:18 CEST 2011


Sarath pointed out (privately) that the standard error is not actually
stored as part of the bootstrap object.

Instead, it is calculated on the fly when you print the bootstrap object;
this is done by
  boot:::print.boot
Similarly for bias.
(The 'boot:::' is necessary because 
"'print.boot' is not an exported object from 'namespace:boot'").

Tim Hesterberg

>Do
>  names(bootObj)
>to find out what the components are, and use $ or [[ to extract
>components.
>Do
>  help(boot)
>for a description of components of the object (look in the Value section).
>
>That is general advice in R, applying to all kinds of objects -
>boot, and many other functions such as lm(), return lists with
>a class added, and you can operate on the object as a list using
>names(), $, etc.
>
>Tim Hesterberg
>
>>Dear R user,
>>
>>I used the following to do a bootstrap.
>>
>>
>>>bootObj<-boot(data=DAT, statistic=Lp.est,
>>R=1000,x0=3)
>>
>>I have the following output from the above bootstrap. How
>>can I extract  components of the output.
>>For example, how can I extract the std.error?
>>
>>
>>> bootObj
>>
>>ORDINARY NONPARAMETRIC BOOTSTRAP
>>
>>Call:
>>boot(data = DAT, statistic = Lp.est, R = 1000, x0 = 3)
>>
>>Bootstrap Statistics :
>>      original        bias              std. error
>>t1*  794.9745 -0.6666341    4.042099
>>
>>Any help is greatly appreciated.
>>
>>Thank you
>>
>>
>>Sarath Banneheka



More information about the R-help mailing list