>>>>> "Scott" == Scott Norton <nortonsm at
verizon.net>
>>>>> on Tue, 15 Jun 2004 00:09:03 -0400 writes:
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