[R] boot() with glm/gnm on a contingency table

Milan Bouchet-Valat nalimilan at club.fr
Wed Sep 12 21:55:33 CEST 2012


Le mercredi 12 septembre 2012 à 07:08 -0700, Tim Hesterberg a écrit :
> One approach is to bootstrap the vector 1:n, where n is the number
> of individuals, with a function that does:
> f <- function(vectorOfIndices, theTable) {
>   (1) create a new table with the same dimensions, but with the counts
>   in the table based on vectorOfIndices.
>   (2) Calculate the statistics of interest on the new table.
> }
> 
> When f is called with 1:n, the table it creates should be the same
> as the original table.  When called with a bootstrap sample of
> values from 1:n, it should create a table corresponding to the
> bootstrap sample.
Indeed, that's another solution I considered, but I wanted to be sure
nothing more reasonable exists. You're right that it's more efficient
than replicating the whole data set. But still, with a typical table of
less than 100 cells and several thousands of observations, this means
creating a potentially long vector, much larger than the original data;
nothing really hard with common machines, to be sure.

If no other way exists, I'll use this. Thanks.




More information about the R-help mailing list