2
$\begingroup$

I've modeled a Bayesian mixed model where my outcome is count data (using a negative binomial model) in R using the rstanarm package. My data consists of multiple observations within sections of an organization on a monthly basis. Using the predict_posterior function, I have established a posterior distribution of fitted values for each observation section for each month.

Now, these sections are grouped into regions, and my client is interested in getting a yearly count in total for the entire organization and then broken down to yearly counts per regions and per sections. I could just add up the MAP estimates, but I want to keep the uncertainty around these estimates. My question is: Is it possible to add up each section's monthly posterior distributions? If so, how would one do this in R, given that each distribution consists of a vector of X draws?

$\endgroup$
2
$\begingroup$

Starting from a sample of monthly whatever, for each month, assumed to be independent, it is straightforward to generate the sum over the year, by simply picking one value for each month at random from the monthly sample.

$\endgroup$
1
  • $\begingroup$ Hi @Xi'an, just out of curiosity, what would need to be done if the months are not independent of each other (let's say there are seasonal variations)? Thanks. $\endgroup$ – Phil Mar 1 '17 at 15:43
1
$\begingroup$

If I understand your question correctly, the answer is yes. If you have draws from distributions of the components and are interested in distribution of their sum, then sums of the components would form the distribution of sums. The only question is if there is no some kind of correlation between components that is unaccounted in your model, since this may influence the results.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.