set.seed(1)
n <- 500
x <- cbind(1, matrix(rnorm(n * 2), n, 2))
eta <- x %*% c(0.3, 0.5, -0.2)
mu <- exp(eta)
if (requireNamespace("MASS", quietly = TRUE)) {
y <- MASS::rnegbin(n, mu = mu, theta = 2)
fit <- fastglm_nb(x, y)
c(theta = fit$theta, fit$coefficients)
}
Run the code above in your browser using DataLab