When setting <math>\frac{\partial f}{\partial x}(x^\star) = 0</math>, we observe that <math>x^\star</math> is present not only alone but also inside the sum, in the <math>p_i</math>'s. This means that an iterative procedure is required, typically [http://en.wikipedia.org/wiki/Newton_method_in_optimization Newton's method].

+

When setting <math>\frac{\partial f}{\partial \beta}(\beta^\star) = 0</math>, we observe that <math>\beta^\star</math> is present not only alone but also inside the sum, in the <math>p_i</math>'s: indeed <math>p_i>/math> is a non-linear function of <math>B</math>. This means that an iterative procedure is required, typically [http://en.wikipedia.org/wiki/Newton_method_in_optimization Newton's method].

Note that the second derivatives of <math>f</math> are strictly negative. Therefore, <math>f</math> is globally convex, which means that it has a unique global maximum, at <math>B^\star</math>. As a consequence, we have the right to use Laplace's method to approximate the integral around its maximum.

Note that the second derivatives of <math>f</math> are strictly negative. Therefore, <math>f</math> is globally convex, which means that it has a unique global maximum, at <math>B^\star</math>. As a consequence, we have the right to use Laplace's method to approximate the integral around its maximum.

Revision as of 18:39, 3 February 2013

Bayesian model of univariate linear regression for QTL detection

This page aims at helping people like me, interested in quantitative genetics, to get a better understanding of some Bayesian models, most importantly the impact of the modeling assumptions as well as the underlying maths. It starts with a simple model, and gradually increases the scope to relax assumptions. See references to scientific articles at the end.

Data: let's assume that we obtained data from N individuals. We note the (quantitative) phenotypes (e.g. expression levels at a given gene), and the genotypes at a given SNP (encoded as allele dose: 0, 1 or 2).

Goal: we want to assess the evidence in the data for an effect of the genotype on the phenotype.

Assumptions: the relationship between genotype and phenotype is linear; the individuals are not genetically related; there is no hidden confounding factors in the phenotypes.

Likelihood: we start by writing the usual linear regression for one individual

where β1 is in fact the additive effect of the SNP, noted a from now on, and β2 is the dominance effect of the SNP, d = ak.

Even though we can write the likelihood as a multivariate Normal, I still keep the term "univariate" in the title because the regression has a single response, Y.
It is usual to keep the term "multivariate" for the case where there is a matrix of responses (i.e. multiple phenotypes).

We can see that ΩT = Ω, which means that Ω is a symmetric matrix.
This is particularly useful here because we can use the following equality: Ω − 1ΩT = I.

This now becomes easy to factorizes totally:

We recognize the kernel of a Normal distribution, allowing us to write the conditional posterior as:

Posterior of τ:

Similarly to the equations above:

But now, to handle the second term, we need to integrate over B, thus effectively taking into account the uncertainty in B:

Again, we use the priors and likelihoods specified above (but everything inside the integral is kept inside it, even if it doesn't depend on B!):

As we used a conjugate prior for τ, we know that we expect a Gamma distribution for the posterior.
Therefore, we can take τN / 2 out of the integral and start guessing what looks like a Gamma distribution.
We also factorize inside the exponential:

We recognize the conditional posterior of B.
This allows us to use the fact that the pdf of the Normal distribution integrates to one:

We finally recognize a Gamma distribution, allowing us to write the posterior as:

Joint posterior (2): sometimes it is said that the joint posterior follows a Normal Inverse Gamma distribution:

In Bayesian modeling, hypothesis testing is performed with a Bayes factor, which in our case can be written as:

We can shorten this into:

Note that, compare to frequentist hypothesis testing which focuses on the null, the Bayes factor requires to explicitly model the data under the alternative.
This makes a big difference when interpreting the results (see below).

Let's start with the numerator:

First, let's calculate what is inside the integral:

Using the formula obtained previously and doing some algebra gives:

Now we can integrate out τ (note the small typo in equation 9 of supplementary text S1 of Servin & Stephens):

Inside the integral, we recognize the almost-complete pdf of a Gamma distribution.
As it has to integrate to one, we get:

We can use this expression also under the null.
In this case, as we need neither a nor d, B is simply μ, ΣB is and X is a vector of 1's.
We can also defines .
In the end, this gives:

We can therefore write the Bayes factor:

When the Bayes factor is large, we say that there is enough evidence in the data to support the alternative.
Indeed, the Bayesian testing procedure corresponds to measuring support for the specific alternative hypothesis compared to the null hypothesis.
Importantly, note that, for a frequentist testing procedure, we would say that there is enough evidence in the data to reject the null.
However we wouldn't say anything about the alternative as we don't model it.

The threshold to say that a Bayes factor is large depends on the field. It is possible to use the Bayes factor as a test statistic when doing permutation testing, and then control the false discovery rate. This can give an idea of a reasonable threshold.

Hyperparameters: the model has 5 hyperparameters, . How should we choose them?

Such a question is never easy to answer. But note that all hyperparameters are not that important, especially in typical quantitative genetics applications. For instance, we are mostly interested in those that determine the magnitude of the effects, σa and σd, so let's deal with the others first.

As explained in Servin & Stephens, the posteriors for τ and B change appropriately with shifts (y + c) and scaling () in the phenotype when taking their limits.
This also gives us a new Bayes factor, the one used in practice (see Guan & Stephens, 2008):

Now, for the important hyperparameters, σa and σd, it is usual to specify a grid of values, i.e. M pairs (σa,σd). For instance, Guan & Stephens used the following grid:

Then, we can average the Bayes factors obtained over the grid using, as a first approximation, equal weights:

In eQTL studies, the weights can be estimated from the data using a hierarchical model (see below), by pooling all genes together as in Veyrieras et al (PLoS Genetics, 2010).

Let's use to denote the i-th row of the design matrix X. We can also keep the same definition as above for . Thus we have:

As the yi's can only take 0 and 1 as values, the likelihood can be written as:

We still use the same prior as above for B (but there is no τ anymore), so that:

where ΣB is a 3 x 3 matrix with on the diagonal and 0 elsewhere.

As above, the Bayes factor is used to compare the two models:

The interesting point here is that there is no way to analytically calculate these integrals (marginal likelihoods). Therefore, we will use Laplace's method to approximate them, as in Guan & Stephens (2008).

Starting with the numerator:

Let's use f to denote the function inside the exponential:

The function f is defined by:

This function will then be used to approximate the integral, like this:

We therefore need to find . As it maximizes f, we need to calculate the first derivatives of f. Let's do this the univariate way:

where β is μ, a or d.

A simple form for the first derivatives of pi also exists when writing :

where is equal to when β corresponds respectively to .

This simplifies the first derivatives of f into:

When setting , we observe that is present not only alone but also inside the sum, in the pi's: indeed pi > / math > isanon − linearfunctionof < math > B. This means that an iterative procedure is required, typically Newton's method.

To use it, we need the second derivatives of f:

The second derivatives of are all equal to 0:

Note that the second derivatives of f are strictly negative. Therefore, f is globally convex, which means that it has a unique global maximum, at . As a consequence, we have the right to use Laplace's method to approximate the integral around its maximum.

finding the maximums: iterative procedure, update equations or generic solver -> to do