I use glm.nb()
function in R MASS
package to estimate the parameters of a negative binomial regression model. How could I calculate the predicted probability (probability mass function) given new data, which R function can I use?
My dataset is as follows. y follows negative binomial distribution and x is covariate. And I use glm.nb(y ~ x, data=data)
to estimate model parameters. Given new x
and y
, how can I calculate the predicted probability.
Is there a way to calculate it using Java?
y x
91 1.000000
79 1.000000
86 1.000000
32 1.000000
41 1.000000
29 0.890609
44 1.000000
42 1.000000
31 0.734058
35 1.000000
x
andy
? (It would be helpful to show a reproducible example) – David Robinson