boot() with glm/gnm on a contingency table
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.