# How to create average model of multiple negative binomial models?

I have 40 datasets, i manage to fit them to negative binomial model with different model parameters (size and mu). I am trying (if this is possible) to get resultant model that will replace "reasonable well" all this models with "default" one. I am planing to make simulation and want to make model for that category of users. Can I use mean values from all model for size and mu for this resultant model. So question is how can I create average model?

example

nd1 <- rnbinom(500, size=0.406, mu = 5.398)
nd2 <- rnbinom(500, size=0.389, mu = 2.544)
nd3 <- rnbinom(500, size=0.351, mu = 4.124)


density curves Now I want "average" for all this datasets, to produce resultant model. Hope that this explain what I am trying to get.

I used average for mu and size, size = (0.406 + 0.389 + 0.351)/3 = 0,382; mu = 5.389 + 2.544 + 4.124)/3 = 4,019, I know that this is real simple approach, is there some other method. My data contain one variable and no predictors.

ndres <- rnbinom(500, size=0.389, mu = 4.019)
plot(density(nd1))
lines(density(nd2))
lines(density(nd3))
lines(density(ndres),col="red") • Not very clear what is the aim of the analysis.. Why would you expect a common mean and dispersion for all the datasets? You can simply fit all of them together to get an estimate but I am guessing thats not what you are after Oct 19, 2020 at 21:39
• Currently I have 40 datasets and 40 models that fits to this datasets. Yes I want to fit them in to one model, how can I do that ? Combine all data in to one dataset? I tried to find mean frequensies of those datasets, but result was zero inflated negative binomial model based on AIC. Oct 19, 2020 at 22:22
• One way would be to rbind all the datasets into one and fit a hierarchical/multilevel model, where the mean and dispersion parameters vary across the datasets. This would give you partially pooled estimates. Oct 29, 2020 at 2:23