Empirical Bayes methods are procedures for statistical inference in which the prior distribution is estimated from the data. This approach stands in contrast to standard Bayesian methods, for which the prior distribution is fixed before any data are observed. Despite this difference in perspective, empirical Bayes may be viewed as an approximation to a fully Bayesian treatment of a hierarchical model wherein the parameters at the highest level of the hierarchy are set to their most likely values, instead of being integrated out. Empirical Bayes, also known as maximum marginal likelihood (Bishop, Neural networks for pattern recognition, 2005), represents one approach for setting hyperparameters.
Introduction
Empirical Bayes methods can be seen as an approximation to a fully Bayesian treatment of a hierarchical Bayes model.
In, for example, a two-stage hierarchical Bayes model, observed data π¦ = {π¦1, π¦2, β¦ , π¦π} are assumed to be generated from an unobserved
set of parameters π = {π1, π2, β¦ , ππ} according to a probability
distribution. In turn, the parameters π can be considered samples drawn from a population characterized by hyperparameters π according to a probability distribution π(π|π). In the hierarchical Bayes model, though not in the empirical Bayes approximation, the hyperparameters π are considered to be drawn from an unparameterized distribution π(π|π). Information about a particular quantity of interest ππ therefore comes
not only from the properties of those data which directly depend on it, but also from the properties of the population of parameters π as a whole, inferred from the data as a whole, summarized by the
hyperparameters π. Using Bayesβ theorem,
π(π|π¦) =π(π¦|π)π(π) π(π¦) =
π(π¦|π)π
π(π¦) β« π(π|π)π(π)ππ.
In general, this integral will not be tractable analytically and must be evaluated by numerical methods. Stochastic approximations using, e.g., Markov Chain Monte Carlo sampling or deterministic approximations such as quadrature are common.
Alternatively, the expression can be written as
π(π|π¦) = β« π(π|π, π¦)π(π|π¦)ππ = β«π(π¦|π)π(π|π)
π(π¦|π) π(π|π¦)ππ, and the term in the integral can in turn be expressed as
π(π|π¦) = β« π(π|π)π(π|π¦)ππ.
These suggest an iterative scheme, qualitatively similar in structure to a Gibbs sampler, to evolve successively improved approximations to π(π|π¦) and π(π|π¦). First, we calculate an initial approximation to π(π|π¦) ignoring the π dependence completely; then we calculate an approximation to π(π|π¦) based upon the initial approximate distribution of π(π|π¦); then we use this π(π|π¦) to update the approximation for π(π|π¦); then we update π(π|π¦); and so on.
When the true distribution π(π|π¦) is sharply peaked, the integral determining π(π|π¦) may not be changed much by replacing the probability distribution over π with a point estimate πβ representing the distributionβs peak (or, alternatively, its mean),
π(π|π¦) βπ(π¦|π)π(π|π
β)
With this approximation, the above iterative scheme becomes the EM algorithm.
The term βEmpirical Bayesβ can cover a wide variety of methods, but most can be regarded as an early truncation of either the above scheme or something quite like it. Point estimates, rather than the whole distribution, are typically used for the parameter(s) π. The estimates for πβ are typically made from the first approximation to π(π|π¦) without subsequent refinement. These estimates for πβ are usually made without considering an appropriate prior distribution for π.
Point estimation
Robbins method: non-parametric empirical Bayes (NPEB)
Robbins (Robbins, 1956) considered a case of sampling from a compound distribution, where probability for each π¦π (conditional on ππ)
is specified by a Poisson distribution, π(π¦π|ππ) =
πππ¦ππβππ
π¦π!
,
while the prior is unspecified except that it is also i.i.d. from an unknown distribution, with cumulative distribution function πΊ(π). Compound sampling arises in a variety of statistical estimation problems, such as accident rates and clinical trials. We simply seek a point prediction of ππ
given all the observed data. Because the prior is unspecified, we seek to do this without knowledge of πΊ (Carlin & Louis, 2000).
Under mean squared error loss (SEL), the conditional expectation πΈ(ππ|ππ) is a reasonable quantity to use for prediction (Nikulin, 2001).
For the Poisson compound sampling model, this quantity is πΈ(ππ|π¦π) =
β«(ππ¦+1πβπβπ¦π!)ππΊ(π)
β«(ππ¦πβπ π¦
π!
β ) ππΊ(π) .
This can be simplified by multiplying the expression by (π¦π+ 1 π¦β π+ 1),
πΈ(ππ|π¦π) =
(π¦π+ 1)ππΊ(π¦π+ 1)
ππΊ(π¦π)
,
where ππΊ is the marginal distribution obtained by integrating out π over
πΊ (Wald, 1971).
To take advantage of this, Robbins (Robbins, 1956) suggested estimating the marginals with their empirical frequencies, yielding the fully non- parametric estimate as:
πΈ(ππ|π¦π) = (π¦π+ 1)
#{ππ= π¦π+ 1}
#{ππ= π¦π}
, where # denotes βnumber ofβ (Good, 1953).
Example - Accident rates
Suppose each customer of an insurance company has an βaccident rateβ π© and is insured against accidents; the probability distribution of π© is the underlying distribution, and is unknown. The number of accidents suffered by each customer in a specified time period has a Poisson distribution with expected value equal to the particular customerβs accident rate. The actual number of accidents experienced by a customer is the observable quantity. A crude way to estimate the underlying probability distribution of the accident rate π© is to estimate the proportion of members of the whole population suffering 0, 1, 2, 3, β¦ accidents during the specified time period as the corresponding proportion in the observed random sample. Having done so, we then desire to predict the accident rate of each customer in the sample. As above, one may use the conditional expected value of the accident rate π© given the observed number of accidents during the baseline period. Thus, if a customer suffers six accidents during the baseline period, that customerβs estimated accident rate is
7 Γ [π‘βπ πππππππ‘πππ ππ π‘βπ π πππππ π€βπ π π’ππππππ 7 ππππππππ‘π ] / [π‘βπ πππππππ‘πππ ππ π‘βπ π πππππ π€βπ π π’ππππππ 6 ππππππππ‘π ]. Note that if the proportion of people suffering π accidents is a
decreasing function of π, the customerβs predicted accident rate will often be lower than their observed number of accidents. This shrinkage effect is typical of empirical Bayes analyses.
Parametric empirical Bayes
If the likelihood and its prior take on simple parametric forms (such as 1- or 2-dimensional likelihood functions with simple conjugate priors), then the empirical Bayes problem is only to estimate the marginal π(π¦|π) and the hyperparameters π using the complete set of empirical measurements. For example, one common approach, called parametric empirical Bayes point estimation, is to approximate the marginal using the maximum likelihood estimate (MLE), or a Moments expansion, which allows one to express the hyperparameters π in terms of the empirical mean and variance. This simplified marginal allows one to plug in the empirical averages into a point estimate for the prior π. The resulting equation for the prior π is greatly simplified, as shown below. There are several common parametric empirical Bayes models, including the Poissonβgamma model (below), the Beta-binomial model, the GaussianβGaussian model, the Dirichlet-multinomial model (Johnson, Kotz, & Kemp, 1992), as well specific models for Bayesian linear regression (see below) and Bayesian multivariate linear regression. More advanced approaches include hierarchical Bayes models and Bayesian mixture models.
Poissonβgamma model
For example, in the example above, let the likelihood be a Poisson distribution, and let the prior now be specified by the conjugate prior, which is a gamma distribution (πΊ(πΌ, π½)) (where π = (πΌ, π½)):
π(π|πΌ, π½) =π
πΌβ1πβπ π½β
π½πΌΞ(πΌ) , for π > 0, πΌ > 0, π½ > 0.
It is straightforward to show the posterior is also a gamma distribution. Write
π(π|π¦) β π(π¦|π)π(π|πΌ, π½),
where the marginal distribution has been omitted since it does not depend explicitly on π. Expanding terms which do depend on π gives the posterior as:
π(π|π¦) β (ππ¦πβπ)(ππΌβ1πβπ π½β ) = ππ¦+πΌβ1πβπ(1+1 π½β ).
So the posterior density is also a gamma distribution πΊ(πΌβ², π½β²), where πΌβ² = π¦ + πΌ, and π½β² = (1 + 1 π½β )β1. Also notice that the marginal is
simply the integral of the posterior over all Ξ, which turns out to be a negative binomial distribution.
To apply empirical Bayes, we will approximate the marginal using the maximum likelihood estimate (MLE). However, since the posterior is a gamma distribution, the MLE of the marginal turns out to be just the mean of the posterior, which is the point estimate πΈ(π|π¦) we need. Recalling that the mean π of a gamma distribution πΊ(πΌβ², π½β²) is simply πΌβ²π½β², we have πΈ(π|π¦) = πΌβ²π½β² = π¦Μ + πΌ 1 + 1 π½β = π½ 1 + π½π¦Μ + 1 1 + π½(πΌπ½).
To obtain the values of πΌ and π½, empirical Bayes prescribes estimating mean πΌπ½ and variance πΌπ½2 using the complete set of empirical data. The resulting point estimate πΈ(π|π¦) is therefore like a weighted average of the sample mean π¦Μ and the prior mean π = πΌπ½. This turns out to be a general feature of empirical Bayes; the point estimates for the prior (i.e., mean) will look like a weighted averages of the sample estimate and the prior estimate (likewise for estimates of the variance).
Bayesian Linear Regression
Bayesian linear regression is an approach to linear regression in which the statistical analysis is undertaken within the context of Bayesian inference. When the regression model has errors that have a normal distribution, and if a particular form of prior distribution is assumed,
explicit results are available for the posterior probability distributions of the modelβs parameters.
Consider a standard linear regression problem, in which for π = 1, . . . , π. We specify the conditional distribution of ππ given a π Γ 1 predictor
vector ππ:
ππ = πΏπππ· + ππ,
where π· is a π Γ 1 vector, and the ππ are independent and identical
normally distributed random variables: ππ~π(π, π2).
This corresponds to the following likelihood function: π(π|πΏ, π·, π2) β (π2)βπ 2β exp (β 1
2π2(π β πΏπ·)
π(π β πΏπ·)) .
The ordinary least squares solution is to estimate the coefficient vector using the Moore-Penrose pseudoinverse (Penrose, 1955) (Ben-Israel & Greville, 2003):
π·Μ = (πΏππΏ)β1πΏππ,
Where πΏ is the π Γ π design matrix, each row of which is a predictor vector πΏππ; and π is the column π-vector [π¦1β― π¦π]π.
This is a βfrequentistβ approach (Neyman, 1937), and it assumes that there are enough measurements to say something meaningful about π·. In the Bayesian approach, the data are supplemented with additional information in the form of a prior probability distribution. The prior belief about the parameters is combined with the dataβs likelihood function according to Bayes theorem to yield the posterior belief about the parameters π· and π. The prior can take different functional forms depending on the domain and the information that is available a priori.
Software
Several software packages are available that perform Empirical Bayes, including the Open Source software R with the limma package. Tos start the package in R, one simply enters the following in the R console at the prompt
>
source(βhttp://bioconductor.org/biocLite.Rβ)biocLite(βlimma β).
Commercial software includes MATLAB, SAS and SPSS.
Example Using R
Model Selection in Bayesian Linear Regression
Consider data generated by π¦π = π1π₯π+ π3π₯π3+ ππ, and suppose we
wish to fit a polynomial of degree 3 to the data. There are then 4 regression coefficients, namely, the intercept and the three coefficients of the power of x. This yields 24= 16 models possible models for the data. Let π1= 8 and π3= β0.5 so that the data looks like this in R:
> rm(list=ls()) > x=runif(200,-10,10) > a=c(18,0,-0.5,0) > Y=a[1]*x^1+a[2]*x^2+a[3]*x^3+a[4] > Y=Y+rnorm(length(Y),0,5) > plot(x,Y)
The code to generate the data and calculate the log marginal likelihood for the different models appears below.
> p=4 > X=cbind(x,x^2,x^3,1) > tf <- c(TRUE, FALSE) > models <- expand.grid(replicate(p,tf,simplify=FALSE)) > names(models) <- NULL > models=as.matrix(models) > models=models[-dim(models)[1],] > a_0=100 > b_0=0.5 > mu_0=rep(0,p) > lambda_0=diag(p) > lml <- function(model){ + n=length(Y) + Y=as.matrix(Y) + X=as.matrix(X[,model]) + mu_0=as.matrix(mu_0[model])
+ lambda_0=as.matrix(lambda_0[model,model]) + XtX=t(X)%*%X + lambda_n=lambda_0 + XtX + BMLE=solve(XtX)%*%t(X)%*%Y + mu_n=solve(lambda_n)%*%(t(X)%*%Y+lambda_0%*%mu_0) + a_n = a_0 + 0.5*n + b_n=b_0 + 0.5*(t(Y)%*%Y + t(mu_0)%*%lambda_0%*%mu_0 β + t(mu_n)%*%lambda_n%*%mu_n) + log_mar_lik <- -0.5*n*log(2*pi) + + 0.5*log(det(lambda_0)) - 0.5*log(det(lambda_n)) + + lgamma(a_n) - lgamma(a_0) + a_0*log(b_0) β
+ a_n*log(b_n) + return(mle) + } > lml.all=apply(models,1,lml) > results=cbind(lml.all, models) > order=sort(results[,1],index=TRUE,decreasing=TRUE) > results[order$ix,]
Model Evaluation
The models are listed in order of descending log marginal likelihood below: lml x x^2 x^3 c [1,] -1339.085 1 0 1 0 [2,] -1341.611 1 0 1 1 [3,] -1345.397 1 1 1 0 [4,] -1347.116 1 1 1 1 [5,] -2188.934 0 0 1 0 [6,] -2190.195 0 0 1 1 [7,] -2194.238 0 1 1 0 [8,] -2196.109 0 1 1 1 [9,] -2393.395 1 0 0 0 [10,] -2395.309 1 0 0 1 [11,] -2399.188 1 1 0 0 [12,] -2401.248 1 1 0 1 [13,] -2477.084 0 0 0 1 [14,] -2480.784 0 1 0 0 [15,] -2483.047 0 1 0 1
> BMLE [,1] x 18.241814068 0.008942083 -0.502597759 -0.398375650
The model with the highest log marginal likelihood is the model which includes π₯ and π₯3 only, for which the MLE of the regression coefficients are 18.241814068 and -0.502597759 for π₯ and π₯3 respectively.