Reputation: 21
I need help with following task in R:
Generate 10000 sample from a Zero Inflated Negative binomial distribution (each sample has 30 observations).
I found function rzinbinom()
but can't figure out the value of the parameters to input; we are not given them in assignment. Are there default values we can input to make the function work?
Upvotes: 1
Views: 410
Reputation: 1719
The zero-inflated negative binomial has three parameters: the probability of 0, and then the two "classic" negative binomial parameters. There are about a dozen ways to parameterize the standard negative binomial, which leads to confusion. In R, the two are classically the mean and the size
, the latter being equivalent to "r" in Klugman-Panger-Willmot or the alpha of the mixing gamma if considering the NB as a Poisson with a gamma prior.
What this means is that even knowing the expected value of each sample, which is what I presume is meant by "each sample has 30 observations", is insufficient to determine precisely which ZINBINOM to use. There are literally countably infinite possibilities with varying pi and size which have mean 30. Either your teacher wanted you to pick any set of parameters that work or your instructions were insufficient.
Upvotes: 0