Skip to content

boot&table

2 messages · Katalin Csillery, Vaidotas Zemlys

#
Hello,

I want to bootstarp a sample, and I need table() for each sample taken,
like if R=100, I need all 100 table(). It seems to mee that boot() works
anly if you assing statistics, that gives you back one number, like
mean. Although the ?boot/statistics says that it can be a vector
containing statistics. table() gives an array, so it might work. Does
anybody have an idea how? I konw it can be done by a loop and
sample() function, but it not as fast as boot().
Another question, how can you get frequencies for sample values, like what
table() does, but with reference to both the value itself and the
corresponding frequencies. I would like to have those values in a matrix
with 2 col. It is very troublesome to make it form what table() returns.

Thanks for your help!

Katalin

___
Katalin Csillery
Division of Biological Sciences
University of Montana, Missoula MT 59801
Phone: 406 243 6106, E-mail: csillery at selway.umt.edu
----------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
Hi,
I am not sure what do you want to do. Function boot needs data as 
vector, matrix, or data.frame. Boot does work with statistics, which 
gives back vector. Give more details, why can't you work with matrix or 
data.frame instead of table.
table2matrix <-
function (x) {
     if (!is.table(x)) {
        stop("I need table")
     }
     mm <- cbind(as.numeric(names(x)),x)
     rownames(mm) <- NULL
     mm
}
Or some other way, it is just an example. As you see, nothing very 
troublesome.

Mpiktas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._