Use a hierarchical Bayesian model with binomial observation errors and a common distribution for the underlying risks:
Give a shared hyperprior, or parameterize them by mean and concentration and put priors on and . Conditional on these hyperparameters, the risks are independent and identically distributed; after integrating them out they are exchangeable random variables with shared uncertainty. The data estimate the overall risk level and between-hospital variation. Conditional Beta-binomial conjugacy gives
and full Bayes point estimates under squared-error loss are
An Empirical Bayes method instead estimates the hyperparameters from the marginal beta-binomial distribution likelihood
and inserts their fitted values in the conditional posterior means. Both approaches provide partial pooling, stronger for smaller hospitals. Full Bayes also propagates hyperparameter uncertainty into the credible intervals. If systematic covariates are needed, one can place exchangeable residual effects in a logistic regression model rather than assuming a common unconditional risk distribution.
The Type II maximum likelihood estimator maximizes the Bayesian model evidence after integrating out the breed parameters:
For positive sample sizes define . Up to an additive constant, the log-likelihood is
Differentiation gives the interior score equation
Also . If , the derivative decreases from infinity to , so a unique finite maximum exists. When all sample sizes equal , the equation becomes , giving
For no finite maximum exists. Plugging this hyperparameter estimate into the breed posterior distributions is an Empirical Bayes method.
After integrating out the multivariate normal distribution , the marginal distribution is
Up to terms independent of , the log-likelihood is
Differentiating and setting the result to zero gives the maximum marginal likelihood estimator
This is an Empirical Bayes method because the estimated hyperparameter is then inserted into the prior and posterior distributions.