# Bayesian hierarchical modeling

Bayesian hierarchical modelling is a statistical model written in multiple levels (hierarchical form) that estimates the parameters of the posterior distribution using the Bayesian method.[1] The sub-models combine to form the hierarchical model, and Bayes' theorem is used to integrate them with the observed data and account for all the uncertainty that is present. The result of this integration is the posterior distribution, also known as the updated probability estimate, as additional evidence on the prior distribution is acquired.

Frequentist statistics may yield conclusions seemingly incompatible with those offered by Bayesian statistics due to the Bayesian treatment of the parameters as random variables and its use of subjective information in establishing assumptions on these parameters.[2] As the approaches answer different questions the formal results aren't technically contradictory but the two approaches disagree over which answer is relevant to particular applications. Bayesians argue that relevant information regarding decision making and updating beliefs cannot be ignored and that hierarchical modeling has the potential to overrule classical methods in applications where respondents give multiple observational data. Moreover, the model has proven to be robust, with the posterior distribution less sensitive to the more flexible hierarchical priors.

Hierarchical modeling is used when information is available on several different levels of observational units. For examples, in epidemiological modeling to describe infection trajectories for multiple countries, observational units are countries, and each country has each own temporal profile of daily infected cases.[3] In decline curve analysis to describe oil or gas production decurve curve for multiple wells, observational units are oil or gas wells in a reservoir region, and each well has each own temporal profile of oil or gas production rates (usually, barrels per month).[4] Data structure for the hierarchical modeling retains nested data structure. The hierarchical form of analysis and organization helps in the understanding of multiparameter problems and also plays an important role in developing computational strategies.[5]

## Philosophy

Statistical methods and models commonly involve multiple parameters that can be regarded as related or connected in such a way that the problem implies dependence of the joint probability model for these parameters.[6] Individual degrees of belief, expressed in the form of probabilities, come with uncertainty.[7] Amidst this is the change of the degrees of belief over time. As was stated by Professor José M. Bernardo and Professor Adrian F. Smith, “The actuality of the learning process consists in the evolution of individual and subjective beliefs about the reality.” These subjective probabilities are more directly involved in the mind rather than the physical probabilities.[7] Hence, it is with this need of updating beliefs that Bayesians have formulated an alternative statistical model which takes into account the prior occurrence of a particular event.[8]

## Bayes' theorem

The assumed occurrence of a real-world event will typically modify preferences between certain options. This is done by modifying the degrees of belief attached, by an individual, to the events defining the options.[9]

Suppose in a study of the effectiveness of cardiac treatments, with the patients in hospital j having survival probability ${\displaystyle \theta _{j}}$, the survival probability will be updated with the occurrence of y, the event in which a controversial serum is created which, as believed by some, increases survival in cardiac patients.

In order to make updated probability statements about ${\displaystyle \theta _{j}}$, given the occurrence of event y, we must begin with a model providing a joint probability distribution for ${\displaystyle \theta _{j}}$ and y. This can be written as a product of the two distributions that are often referred to as the prior distribution ${\displaystyle P(\theta )}$ and the sampling distribution ${\displaystyle P(y\mid \theta )}$ respectively:

${\displaystyle P(\theta ,y)=P(\theta )P(y\mid \theta )}$

Using the basic property of conditional probability, the posterior distribution will yield:

${\displaystyle P(\theta \mid y)={\frac {P(\theta ,y)}{P(y)}}={\frac {P(y\mid \theta )P(\theta )}{P(y)}}}$

This equation, showing the relationship between the conditional probability and the individual events, is known as Bayes' theorem. This simple expression encapsulates the technical core of Bayesian inference which aims to incorporate the updated belief, ${\displaystyle P(\theta \mid y)}$, in appropriate and solvable ways.[9]

## Exchangeability

The usual starting point of a statistical analysis is the assumption that the n values ${\displaystyle y_{1},y_{2},\ldots ,y_{n}}$ are exchangeable. If no information – other than data y – is available to distinguish any of the ${\displaystyle \theta _{j}}$’s from any others, and no ordering or grouping of the parameters can be made, one must assume symmetry among the parameters in their prior distribution.[10] This symmetry is represented probabilistically by exchangeability. Generally, it is useful and appropriate to model data from an exchangeable distribution as independently and identically distributed, given some unknown parameter vector ${\displaystyle \theta }$, with distribution ${\displaystyle P(\theta )}$.

### Finite exchangeability

For a fixed number n, the set ${\displaystyle y_{1},y_{2},\ldots ,y_{n}}$ is exchangeable if the joint probability ${\displaystyle P(y_{1},y_{2},\ldots ,y_{n})}$ is invariant under permutations of the indices. That is, for every permutation ${\displaystyle \pi }$ or ${\displaystyle (\pi _{1},\pi _{2},\ldots ,\pi _{n})}$ of (1, 2, …, n), ${\displaystyle P(y_{1},y_{2},\ldots ,y_{n})=P(y_{\pi _{1}},y_{\pi _{2}},\ldots ,y_{\pi _{n}}).}$[11]

Following is an exchangeable, but not independent and identical (iid), example: Consider an urn with a red ball and a blue ball inside, with probability ${\displaystyle {\frac {1}{2}}}$ of drawing either. Balls are drawn without replacement, i.e. after one ball is drawn from the n balls, there will be n − 1 remaining balls left for the next draw.

${\displaystyle {\text{Let }}Y_{i}={\begin{cases}1,&{\text{if the }}i{\text{th ball is red}},\\0,&{\text{otherwise}}.\end{cases}}}$

Since the probability of selecting a red ball in the first draw and a blue ball in the second draw is equal to the probability of selecting a blue ball on the first draw and a red on the second draw, both of which are equal to 1/2 (i.e. ${\displaystyle [P(y_{1}=1,y_{2}=0)=P(y_{1}=0,y_{2}=1)={\frac {1}{2}}]}$), then ${\displaystyle y_{1}}$ and ${\displaystyle y_{2}}$ are exchangeable.

But the probability of selecting a red ball on the second draw given that the red ball has already been selected in the first draw is 0, and is not equal to the probability that the red ball is selected in the second draw which is equal to 1/2 (i.e. ${\displaystyle [P(y_{2}=1\mid y_{1}=1)=0\neq P(y_{2}=1)={\frac {1}{2}}]}$). Thus, ${\displaystyle y_{1}}$ and ${\displaystyle y_{2}}$ are not independent.

If ${\displaystyle x_{1},\ldots ,x_{n}}$ are independent and identically distributed, then they are exchangeable, but the converse is not necessarily true.[12]

### Infinite exchangeability

Infinite exchangeability is the property that every finite subset of an infinite sequence ${\displaystyle y_{1}}$, ${\displaystyle y_{2},\ldots }$ is exchangeable. That is, for any n, the sequence ${\displaystyle y_{1},y_{2},\ldots ,y_{n}}$ is exchangeable.[12]

## Hierarchical models

### Components

Bayesian hierarchical modeling makes use of two important concepts in deriving the posterior distribution,[1] namely:

1. Hyperparameters: parameters of the prior distribution
2. Hyperpriors: distributions of Hyperparameters

Suppose a random variable Y follows a normal distribution with parameter θ as the mean and 1 as the variance, that is ${\displaystyle Y\mid \theta \sim N(\theta ,1)}$. The tilde relation ${\displaystyle \sim }$ can be read as "has the distribution of" or "is distributed as". Suppose also that the parameter ${\displaystyle \theta }$ has a distribution given by a normal distribution with mean ${\displaystyle \mu }$ and variance 1, i.e. ${\displaystyle \theta \mid \mu \sim N(\mu ,1)}$. Furthermore, ${\displaystyle \mu }$ follows another distribution given, for example, by the standard normal distribution, ${\displaystyle {\text{N}}(0,1)}$. The parameter ${\displaystyle \mu }$ is called the hyperparameter, while its distribution given by ${\displaystyle {\text{N}}(0,1)}$ is an example of a hyperprior distribution. The notation of the distribution of Y changes as another parameter is added, i.e. ${\displaystyle Y\mid \theta ,\mu \sim N(\theta ,1)}$. If there is another stage, say, ${\displaystyle \mu }$ follows another normal distribution with mean ${\displaystyle \beta }$ and variance ${\displaystyle \epsilon }$, meaning ${\displaystyle \mu \sim N(\beta ,\epsilon )}$, ${\displaystyle {\mbox{ }}}$${\displaystyle \beta }$ and ${\displaystyle \epsilon }$ can also be called hyperparameters while their distributions are hyperprior distributions as well.[6]

### Framework

Let ${\displaystyle y_{j}}$ be an observation and ${\displaystyle \theta _{j}}$ a parameter governing the data generating process for ${\displaystyle y_{j}}$. Assume further that the parameters ${\displaystyle \theta _{1},\theta _{2},\ldots ,\theta _{j}}$ are generated exchangeably from a common population, with distribution governed by a hyperparameter ${\displaystyle \phi }$.
The Bayesian hierarchical model contains the following stages:

${\displaystyle {\text{Stage I: }}y_{j}\mid \theta _{j},\phi \sim P(y_{j}\mid \theta _{j},\phi )}$
${\displaystyle {\text{Stage II: }}\theta _{j}\mid \phi \sim P(\theta _{j}\mid \phi )}$
${\displaystyle {\text{Stage III: }}\phi \sim P(\phi )}$

The likelihood, as seen in stage I is ${\displaystyle P(y_{j}\mid \theta _{j},\phi )}$, with ${\displaystyle P(\theta _{j},\phi )}$ as its prior distribution. Note that the likelihood depends on ${\displaystyle \phi }$ only through ${\displaystyle \theta _{j}}$.

The prior distribution from stage I can be broken down into:

${\displaystyle P(\theta _{j},\phi )=P(\theta _{j}\mid \phi )P(\phi )}$ [from the definition of conditional probability]

With ${\displaystyle \phi }$ as its hyperparameter with hyperprior distribution, ${\displaystyle P(\phi )}$.

Thus, the posterior distribution is proportional to:

${\displaystyle P(\phi ,\theta _{j}\mid y)\propto P(y_{j}\mid \theta _{j},\phi )P(\theta _{j},\phi )}$ [using Bayes' Theorem]
${\displaystyle P(\phi ,\theta _{j}\mid y)\propto P(y_{j}\mid \theta _{j})P(\theta _{j}\mid \phi )P(\phi )}$[13]

### Example

To further illustrate this, consider the example: A teacher wants to estimate how well a student did on the SAT. The teacher uses information on the student’s high school grades and current grade point average (GPA) to come up with an estimate. The student's current GPA, denoted by ${\displaystyle Y}$, has a likelihood given by some probability function with parameter ${\displaystyle \theta }$, i.e. ${\displaystyle Y\mid \theta \sim P(Y\mid \theta )}$. This parameter ${\displaystyle \theta }$ is the SAT score of the student. The SAT score is viewed as a sample coming from a common population distribution indexed by another parameter ${\displaystyle \phi }$, which is the high school grade of the student (freshman, sophomore, junior or senior).[14] That is, ${\displaystyle \theta \mid \phi \sim P(\theta \mid \phi )}$. Moreover, the hyperparameter ${\displaystyle \phi }$ follows its own distribution given by ${\displaystyle P(\phi )}$, a hyperprior. To solve for the SAT score given information on the GPA,

${\displaystyle P(\theta ,\phi \mid Y)\propto P(Y\mid \theta ,\phi )P(\theta ,\phi )}$
${\displaystyle P(\theta ,\phi \mid Y)\propto P(Y\mid \theta )P(\theta \mid \phi )P(\phi )}$

All information in the problem will be used to solve for the posterior distribution. Instead of solving only using the prior distribution and the likelihood function, the use of hyperpriors gives more information to make more accurate beliefs in the behavior of a parameter.[15]

### 2-stage hierarchical model

In general, the joint posterior distribution of interest in 2-stage hierarchical models is:

${\displaystyle P(\theta ,\phi \mid Y)={P(Y\mid \theta ,\phi )P(\theta ,\phi ) \over P(Y)}={P(Y\mid \theta )P(\theta \mid \phi )P(\phi ) \over P(Y)}}$
${\displaystyle P(\theta ,\phi \mid Y)\propto P(Y\mid \theta )P(\theta \mid \phi )P(\phi )}$[15]

### 3-stage hierarchical model

For 3-stage hierarchical models, the posterior distribution is given by:

${\displaystyle P(\theta ,\phi ,X\mid Y)={P(Y\mid \theta )P(\theta \mid \phi )P(\phi \mid X)P(X) \over P(Y)}}$
${\displaystyle P(\theta ,\phi ,X\mid Y)\propto P(Y\mid \theta )P(\theta \mid \phi )P(\phi \mid X)P(X)}$[15]

## References

1. ^ a b Allenby, Rossi, McCulloch (January 2005). "Hierarchical Bayes Model: A Practitioner’s Guide". Journal of Bayesian Applications in Marketing, pp. 1–4. Retrieved 26 April 2014, p. 3
2. ^ Gelman, Andrew; Carlin, John B.; Stern, Hal S. & Rubin, Donald B. (2004). Bayesian Data Analysis (second ed.). Boca Raton, Florida: CRC Press. pp. 4–5. ISBN 1-58488-388-X.
3. ^ Lee, Se Yoon; Lei, Bowen; Mallick, Bani (2020). "Estimation of COVID-19 spread curves integrating global data and borrowing information". PLOS ONE. doi:10.1371/journal.pone.0236860.
4. ^ Lee, Se Yoon; Mallick, Bani (2021). "Bayesian Hierarchical Modeling: Application Towards Production Results in the Eagle Ford Shale of South Texas". Sankhya B. doi:10.1007/s13571-020-00245-8.
5. ^ Gelman et al. 2004, p. 6.
6. ^ a b Gelman et al. 2004, p. 117.
7. ^ a b Good, I.J. (1980). "Some history of the hierarchical Bayesian methodology". Trabajos de Estadistica y de Investigacion Operativa. 31: 489–519. doi:10.1007/BF02888365. S2CID 121270218.
8. ^ Bernardo, Smith(1994). Bayesian Theory. Chichester, England: John Wiley & Sons, ISBN 0-471-92416-4, p. 23
9. ^ a b Gelman et al. 2004, pp. 6–8.
10. ^ Bernardo, Degroot, Lindley (September 1983). “Proceedings of the Second Valencia International Meeting”. Bayesian Statistics 2. Amsterdam: Elsevier Science Publishers B.V, ISBN 0-444-87746-0, pp. 167–168
11. ^ Gelman et al. 2004, pp. 121–125.
12. ^ a b Diaconis, Freedman (1980). “Finite exchangeable sequences”. Annals of Probability, pp. 745–747
13. ^ Bernardo, Degroot, Lindley (September 1983). “Proceedings of the Second Valencia International Meeting”. Bayesian Statistics 2. Amsterdam: Elsevier Science Publishers B.V, ISBN 0-444-87746-0, pp. 371–372
14. ^ Gelman et al. 2004, pp. 120–121.
15. ^ a b c Box G. E. P., Tiao G. C. (1965). "Multiparameter problem from a bayesian point of view". Multiparameter Problems From A Bayesian Point of View Volume 36 Number 5. New York City: John Wiley & Sons, ISBN 0-471-57428-7