if (require("mfx", quietly = TRUE)) {
set.seed(12345)
n <- 1000
x <- rnorm(n)
y <- rnegbin(n, mu = exp(1 + 0.5 * x), theta = 0.5)
d <- data.frame(y, x)
model <- poissonmfx(y ~ x, data = d)
p_value(model)
p_value(model, component = "marginal")
}
Run the code above in your browser using DataLab