how to get overdispersion parameter for negative binomial from summary()

58 views
Skip to first unread message

Aminath Shausan

unread,
May 13, 2024, 9:59:52 PM5/13/24
to R-inla discussion group
Hi 
I have fitted a negative binomial model and wanted to get summary (mean, sd, credible interval) for over dispersion parameter. Reading through the document I understand it should be size   hyper parameter. 
I don't quite understand the summary output for the model when it says "size for the nbinomial observations (1/overdispersion)". Does this mean, to get the above stats for over dispersion, I need to take 1/mean, 1/sd , etc? 

Thanks

Helpdesk (Haavard Rue)

unread,
May 14, 2024, 6:12:49 AM5/14/24
to Aminath Shausan, R-inla discussion group
n = 10^4
x = rnorm(n, sd = 0.2)
eta = 3 + x
E = runif(n, min = 1, max=10)
E[] =1

size = 20
q = E*exp(eta);
quantile <- 0.5
p = 1.0 - qbeta(quantile, q + 1.0, size, lower.tail = FALSE);
lambda = size * (1.0 - p) / p / E;
mu = E * lambda
y = rnbinom(n, size, mu=mu)

r = inla(y ~ 1 + x, data = data.frame(y, x, E),
family = "nbinomial", E=E, verbose=T)

summary(r)
> --
> You received this message because you are subscribed to the Google Groups "R-
> inla discussion group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to r-inla-discussion...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/r-inla-discussion-group/0c8191bd-ac19-406f-b3ea-6204b72be7acn%40googlegroups.com
> .

--
Håvard Rue
he...@r-inla.org
Reply all
Reply to author
Forward
0 new messages