Greetings Jorge;

There certainly did not seem to be something readily apparent with str(bmean), so the next logical place to look would be for a print method. If you look at print.boot with:

getAywhere(print.boot)

... you see that the first portion sets up an internal structure called "op" and the last of the function prints this with optional headers. If you strip out the sections with headers you get:

lim.boot <- function (x, digits = getOption("digits"), index = 1L:ncol(boot.out$t),
    ...)
{
    boot.out <- x
    sim <- boot.out$sim
    cl <- boot.out$call
    t <- matrix(boot.out$t[, index], nrow = nrow(boot.out$t))
    allNA <- apply(t, 2L, function(t) all(is.na(t)))
    ind1 <- index[allNA]
    index <- index[!allNA]
    t <- matrix(t[, !allNA], nrow = nrow(t))
    rn <- paste("t", index, "*", sep = "")
    if (length(index) == 0L)
        op <- NULL
    else if (is.null(t0 <- boot.out$t0)) {
        if (is.null(boot.out$call$weights))
            op <- cbind(apply(t, 2L, mean, na.rm = TRUE), sqrt(apply(t,
                2L, function(t.st) var(t.st[!is.na(t.st)]))))
        else {
            op <- NULL
            for (i in index) op <- rbind(op, imp.moments(boot.out,
                index = i)$rat)
            op[, 2L] <- sqrt(op[, 2])
        }
        dimnames(op) <- list(rn, c("mean", "std. error"))
    }
    else {
        t0 <- boot.out$t0[index]
        if (is.null(boot.out$call$weights)) {
            op <- cbind(t0, apply(t, 2L, mean, na.rm = TRUE) -
t0, sqrt(apply(t, 2L, function(t.st) var(t.st[! is.na(t.st)]))))
            dimnames(op) <- list(rn, c("original", " bias  ",
                " std. error"))
        }
        else {
            op <- NULL
            for (i in index) op <- rbind(op, imp.moments(boot.out,
                index = i)$rat)
            op <- cbind(t0, op[, 1L] - t0, sqrt(op[, 2L]), apply(t,
                2L, mean, na.rm = TRUE))
            dimnames(op) <- list(rn, c("original", " bias  ",
                " std. error", " mean(t*)"))
        }
    }

    cat("\n\nBootstrap Statistics :\n")
    if (!is.null(op))
        print(op, digits = digits)
    if (length(ind1) > 0L)
        for (j in ind1) cat(paste("WARNING: All values of t",
            j, "* are NA\n", sep = ""))
    invisible(boot.out)
}
#--------------------------------
lim.boot(bmean)


Bootstrap Statistics :
     original      bias    std. error
t1* 0.0904059 0.004641537  0.09239923

Probably too much in that function, but it does what was requested.

--
David Winsemius


On Mar 31, 2009, at 5:49 PM, Jorge Ivan Velez wrote:

Let's say I have the following:

# Loading the boot package
# install.packages(boot)
library(boot)

# Generating data
set.seed(123)
x <- rnorm(100)

# Bootstrap for the sample mean
bmean <- boot(x, function(x,d) mean(x[d]), R=1000)
bmean
#
#ORDINARY NONPARAMETRIC BOOTSTRAP
#
#
#Call:
#boot(data = x, statistic = function(x, d) mean(x[d]), R = 1000)
#
#
#Bootstrap Statistics :
#     original      bias    std. error
#t1* 0.0904059 0.004641537  0.09239923


and I would like to get just this:


Bootstrap Statistics :
    original      bias    std. error
t1* 0.0904059 0.004641537  0.09239923


How can I do that?  I'm running R 2.8.1 Patched on XP SP2. Here is my
sessionInfo():


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
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