[R] Zero-inflated Negative Binomial Error
bbolker at gmail.com
Tue Dec 27 05:49:16 CET 2011
Melissa Aikens <mla2j <at> virginia.edu> writes:
> I am having a problem with the zero-inflated negative binomial (package
> pscl). I have 6 sites with plant populations, and I am trying to model the
> number of seeds produced as a function of their size and their site.
> Anyways, the code I have used for the zero-inflated binomial is:
> fit.fec=zeroinfl(seeds~site/size-1 |
> This code works fine on the data I have. The problem I'm having is when I
> bootstrap this equation, after about 250 iterations, I get the following
> error message: "Error: NA/NaN/Inf in foreign function call (arg 1)."
> The bootstrap code is:
> I have looked at size.boot, seeds.boot, and site, and none of them have
> missing values. I'm really puzzled why it takes 250+ iterations for this
> problem to crop up. When I used a subset of this data, it took fewer
> iterations for this problem to occur - so maybe it has to do with sample
> Therefore, it must be some problematic combination of values that's being
> chosen, though I can't for the life of me figure it out (for example, it
> doesn't seem like there are an outrageous number of 0's when it crashes).
> Also, I tried running the problematic size.boot and seeds.boot vectors with
> just a negative binomial model (glm.nb), and I get the same error. Can
> anyone provide some insight into what is going on?
This is not reproducible (see e.g. http://tinyurl.com/reproducible-000 ),
so it's a little hard to say exactly. Can you post the problematic
size.boot and seeds.boot vectors?
You could also use 'try()' to skip over bad data sets ...
(Using set.seed() for reproducibility is also a good idea.)
More information about the R-help