I want to get the values of bootstrap statistics (original, bias and error) into a separate list - but I cannot figure out how to do that.
Here's an example:
> library(boot)
> set.seed(123)
> mean.fun <- function(data, idx) { mean(data[idx]) }
> data <- boot(data=rnorm(100), statistic=mean.fun, R=999)
> names(data)
[1] "t0" "t" "R" "data"
[5] "seed" "statistic" "sim" "call"
[9] "stype" "strata" "weights"
> data
ORDINARY NONPARAMETRIC BOOTSTRAP
Call:
boot(data = rnorm(100), statistic = mean.fun, R = 999)
Bootstrap Statistics :
original bias std. error
t1* 0.09040591 0.004751773 0.08823615
Now, instead of text I want the actual values. Apparently data$t0
is the "original" but I don't see how to get the values for bias and error.
Also, since typing a function name gives you its code, I typed boost
in R and copied a snippet from the source code, and tried to search it on my local R installation. But couldn't find anything. Why, shouldn't R grab that source code from a local storage?
The std.error and bias are not stored as a part of the boot object. It is calculated on the fly (see: https://stat.ethz.ch/pipermail/r-help/2011-July/284660.html)
In your case, try:
mean(data$t) - data$t0
sd(data$t)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With