Has anyone worked with NY police stops data mentioned in Gelman, Hill book Data Analysis Using Reg. and Multi/Hier Modeling (ARM). The data is under
http://www.stat.columbia.edu/~gelman/arm/examples/police/
the file is frisk_with_noise.dat. I removed the description part of this data, renamed past.arrests as arrests, saved it as frisk.dat. Called glm from R like this:
library ("foreign")
frisk <- read.table ("frisk.dat", header=TRUE)
attach (frisk)
glm(formula = stops ~ 1, family=poisson, offset=log(arrests))
The glm call is right out of ARM book. In any case, I get the error:
Error: NA/NaN/Inf in foreign function call (arg 4)
Any ideas? Gelman has a piece of code under the same directory called police_setup.R that is supposed to have some cleanup code, but that doesnt work either.
I haven’t gone back to look at exactly what Gelman is doing in this chapter (my copy of the book is in storage …), but the specific problem with this example is that ‘arrests’ is zero in some cases, so using log(arrests) as an offset causes problems. (You don’t need library(foreign), and using a data argument to glm is usually safer/better than using attach().)