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:
--------------------------------------------------------------
------------------------------------------------------------------
I'm interested in the value for std.error (i.e. 450.9763).
Now executing the folling:
------------------------------------------------------------------
summary(b.boot)
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" == 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
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.
Only if Angelo Canty (the author) was happy too. If anyone is thinking of
doing this, please discuss it with Angelo first.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
On Tue, 15 Jun 2004, Martin Maechler wrote:
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.
Only if Angelo Canty (the author) was happy too. If anyone is thinking of
doing this, please discuss it with Angelo first.
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....
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907