Skip to content

Parsing results from boot

4 messages · Scott Norton, Martin Maechler, Brian Ripley +1 more

#
This probably has a super easy answer...but I claim newbie status! (I did
search help lists but this question is hard to isolate keyword-wise)

Basically, I'm trying to figure out how to parse the results from executing
boot().  I'm mainly interested in assigning the standard error estimate to a
scalar variable.

For example:
--------------------------------------------------------------
ORDINARY NONPARAMETRIC BOOTSTRAP


Call:
boot(data = b, statistic = function(b, i) median(b[i]), R = 1000)


Bootstrap Statistics :
    original  bias    std. error
t1*      130  354.75    450.9763
------------------------------------------------------------------
I'm interested in the value for std.error (i.e. 450.9763).  

Now executing the folling:
------------------------------------------------------------------
Length Class  Mode     
t0           1   -none- numeric  
t         1000   -none- numeric  
R            1   -none- numeric  
data         9   -none- numeric  
seed       626   -none- numeric  
statistic    1   -none- function 
sim          1   -none- character
call         4   -none- call     
stype        1   -none- character
strata       9   -none- numeric  
weights      9   -none- numeric
-------------------------------------------------------------------
seems to imply that it's not actually assigned to an output variable...but
it is shown when I just type "b.boot" 
Where is the std.error being assigned? and how to I access it?

Thanks in advance...

-Scott
#
Scott> This probably has a super easy answer...but I claim
    Scott> newbie status! (I did search help lists but this
    Scott> question is hard to isolate keyword-wise)

    Scott> Basically, I'm trying to figure out how to parse the
    Scott> results from executing boot().  I'm mainly interested
    Scott> in assigning the standard error estimate to a scalar
    Scott> variable.

    Scott> For example:
    Scott> --------------------------------------------------------------
    >> b<-c(100,100,120,130,1000,1200,1100,1150,125)
    >> b.boot <- boot(b, function(b,i) median(b[i]), R=1000)
    >> b.boot

    Scott> ORDINARY NONPARAMETRIC BOOTSTRAP


    Scott> Call:
    Scott> boot(data = b, statistic = function(b, i) median(b[i]), R = 1000)


    Scott> Bootstrap Statistics :
    Scott> original  bias    std. error
    Scott> t1*      130  354.75    450.9763
    >> 
    Scott> ------------------------------------------------------------------
    Scott> I'm interested in the value for std.error (i.e. 450.9763).  

    Scott> Now executing the folling:
    Scott> ------------------------------------------------------------------
    >> summary(b.boot)
    Scott>           Length Class  Mode     
    Scott> t0           1   -none- numeric  
    Scott> t         1000   -none- numeric  
    Scott> R            1   -none- numeric  
    Scott> data         9   -none- numeric  
    Scott> seed       626   -none- numeric  
    Scott> statistic    1   -none- function 
    Scott> sim          1   -none- character
    Scott> call         4   -none- call     
    Scott> stype        1   -none- character
    Scott> strata       9   -none- numeric  
    Scott> weights      9   -none- numeric  
    Scott> -------------------------------------------------------------------

which shows that summary.default() is called because there's no
summary() method for 'boot' objects [comment see below].

    Scott> seems to imply that it's not actually assigned to an
    Scott> output variable...but it is shown when I just type "b.boot"
    Scott>  Where is the std.error being assigned?

Logically, it must be in the print() method for 'boot' objects..
	 
    Scott>   and how to I access it?

Typing
     getS3method("print", class = "boot")
or   getAnywhere("print.class")

gives a humongous function listing, and somewhere in there

        t0 <- boot.out$t0[index]
        if (is.null(boot.out$call$weights)) {
            op <- cbind(t0, apply(t, 2, mean, na.rm = TRUE) - 
                t0, sqrt(apply(t, 2, function(t.st) var(t.st[!is.na(t.st)]))))
            dimnames(op) <- list(rn, c("original", " bias  ", 
                " std. error"))
        }

(which is not sufficient to understand the code).
So you see that this is really computed inside the print method.

If boot was programmed as we do other typical ``classes''.
The print method would print much less,
the summary method would compute all the interested quantities
and return an object of class "summary.boot" and there would be
a simple  print.summary.boot() method.

I assume Brian Ripley (as maintainer of 'boot') would accept
(well-written) user contributions to implement these, instead of
the current print.boot() mess^H^H^H^Himplementation.

Regards,
Martin Maechler
#
On Tue, 15 Jun 2004, Martin Maechler wrote:

            
Only if Angelo Canty (the author) was happy too.  If anyone is thinking of 
doing this, please discuss it with Angelo first.
#
Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
If someone is feeling up to the necessary brow-beating, he/she might
want to apply it to Terry Therneau and summary.coxph as well. Of
course it is somewhat discouraging that neither Brian nor Thomas seem
to have been successful in getting the point across....