In the boot package,consider a scalar function to boot.

> estimator <- function(x, d) {
+  mean(x[d])
+ }
>
> data <- city$u
> b <- boot(data, estimator, R=1000)
> b$t0
[1] 64
> ci <- boot.ci(b, type=c("bca"), conf=.95)
> ci$bca
     conf
[1,] 0.95 49.44 991.39 36.78807 110.0254

Now if I want estimators to return a vector,E.g. it's
{c(mean(x[d]), sd(x[d]))}, boot.ci() should give me
a vector of low bounds and high bounds of the 95% confidence
interval. But that does not happen.

> estimator <- function(x, d) {
+  c(mean(x[d]), sd(x[d]))
+ }
>
>  data <- city$u
>  b <- boot(data, estimator, R=1000)
>  b$t0
[1] 64.00000 56.21585
>  ci <- boot.ci(b, type=c("bca"), conf=.95)
>  ci$bca
     conf
[1,] 0.95 68.27 995.48 39.2 105.4292

Any help?

        [[alternative HTML version deleted]]

______________________________________________
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