# Table 10.12, Hilbe. J.M. (2011), Negative Binomial Regression,
# 2nd ed. Cambridge University Press (adapted)
if (FALSE) {
data(medpar)
nobs <- 50000
x2 <- runif(nobs)
x1 <- runif(nobs)
xb <- 1.25*x1 + .1*x2 - 1.5
mu <- 1/(exp(-xb)-1)
p <- 1/(1+mu)
r <- 1
gcy <- rnbinom(nobs, size=r, prob = p)
test <- data.frame(gcy, x1, x2)
nbc <- ml.nbc(gcy ~ x1 + x2, data=test)
nbc
}
Run the code above in your browser using DataLab