Using <math>X_i</math> to denote the <math>i</math>-th row of the design matrix <math>X</math> and keeping the same definition as above for <math>B</math>, we have:

Using <math>X_i</math> to denote the <math>i</math>-th row of the design matrix <math>X</math> and keeping the same definition as above for <math>B</math>, we have:

Line 306:

Line 306:

The interesting point here is that there is no way to calculate these integrals analytically. Therefore, we will use [http://en.wikipedia.org/wiki/Laplace_approximation Laplace's method] to approximate them, as in Guan & Stephens (2008).

The interesting point here is that there is no way to calculate these integrals analytically. Therefore, we will use [http://en.wikipedia.org/wiki/Laplace_approximation Laplace's method] to approximate them, as in Guan & Stephens (2008).

The second derivatives of <math>f</math> are strictly negative. Therefore, <math>f</math> is globally convex and hence has a unique global maximum, at <math>B^\star = [\mu^\star a^\star d^\star]^T</math>. As a consequence, we have the right to use the Laplace's method to approximate each integral of the Bayes factor around their respective maximum.

+

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 = [\mu^\star a^\star d^\star]^T</math>. As a consequence, we have the right to use the Laplace's method to approximate the integral around its maximum.

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

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

Revision as of 18:04, 11 January 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).

Binary phenotype: using a similar notation, we model case-control studies with a logistic regression where the probability to be a case is .

There are many equivalent ways to write the likelihood, the usual one being:

Using Xi to denote the i-th row of the design matrix X and keeping the same definition as above for B, 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) and the Bayes factor now is:

The interesting point here is that there is no way to calculate these integrals analytically. 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:

First we need to calculate the first derivatives of f, noting that they all have a very similar form:

where x is μ, a or d.

Also, there is a simple form for the first derivatives of pi:

where is 1 for μ, gi for a, and for d.

This gives us one equation per parameter:

Second, we need to calculate the second derivatives of f:

...

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 the Laplace's method to approximate the integral around its maximum.