[R] boot() with glm/gnm on a contingency table
Milan Bouchet-Valat
nalimilan at club.fr
Tue Sep 11 16:37:36 CEST 2012
Hi everyone!
In a package I'm developing, I have created a custom function to get
jackknife standard errors for the parameters of a gnm model (which is
essentially the same as a glm model for this issue). I'd like to add
support for bootstrap using package boot, but I couldn't find how to
proceed.
The problem is, my data is a table object. Thus, I don't have one
individual per line: when the object is converted to a data frame, one
row represents one cell, or one combination of factor levels. I cannot
pass this to boot() as the "data" argument and use "indices" from my
custom statistic() function, since I would drop cells, not individual
observations.
A very inefficient solution would be to create a data frame with one row
per observation, by replicating each cell using its frequencies. That's
really a brute force solution, though. ;-)
The other way would be generate importance weights based on observed
frequencies, and to multiply the original data by the weights at each
iteration, but I'm not sure that's correct. Thoughts?
Thanks for your help!
More information about the R-help
mailing list