Last updated: 2017-02-20
Code version: d20b048
You should be familiar with Bayesian inference for a continuous parameter.
Suppose we want to do inference for multiple parameters, and suppose that the data that are informative for each parameter are independent. Then provided the prior distributions on these parameters are independent, the posterior distributions are also independent. This is useful as it essentially means we can do Bayesian inference for all the parameters by doing the inference for each parameter separately.
Suppose we have data D1 that depend on parameter θ1, and independent data D2 that depend on a second parameter θ2. That is, suppose that the joint distribution of the data (D1,D2) factorizes as p(D1,D2|θ1,θ2)=p(D1|θ1)p(D2|θ2).
Now assume that our prior distribution on (θ1,θ2) has the property that θ1,θ2 are independent. (This is sometimes said “θ1 and θ2 are a priori independent”.) Intuitively this independence assumption means that telling you θ1 would not tell you anything about θ2. Mathematically, the independence assumption means that the prior distribution for θ1,θ2 factorizes as p(θ1,θ2)=p(θ1)p(θ2).
Applying Bayes theorem we have
p(θ1,θ2|D1,D2)∝p(D1,D2|θ1,θ2)p(θ1,θ2)∝p(D1|θ1)p(D2|θ2)p(θ1)p(θ2)=p(D1|θ1)p(θ1)p(D2|θ2)p(θ2)∝p(θ1|D1)p(θ2|D2)That is, the posterior distribution on θ1,θ2 factorizes into independent parts p(θ1|D1) and p(θ2|D2). We say “θ1 and θ2 are a posteriori independent”.
This result extends naturally from 2 parameters to J parameters. That is, if we have independent data sets D1,…,DJ that depend on parameters θ1,…,θJ, with p(D1,…,DJ|θ1,…,θJ)=J∏j=1p(Dj|θj) and we assume independent priors p(θ1,…,θJ)=J∏j=1p(θj) then the posteriors also factorize p(θ1,…,θJ|D1,…,DJ)=J∏j=1p(θj|Dj).
Suppose we collect genetic data on n elephants at J locations along the genome (“loci”). Suppose that at each location there are two genetic types (“alleles”) that we label “0” and “1”. Our goal is to estimate the frequency of the “1” allele, qj, at each locus j=1,…,J.
Let nja denote the number of alleles of type a observed at locus j (a∈{0,1}, j∈{1,2,…,J}). Let nj denote the data at locus j (so nj=(nj0,nj1)) and n denote the data at all J loci.
Also let q denote the vector (q1,…,qJ).
Thus, n denotes the data and q denotes the unknown parameters. To do Bayesian inference for q we want to compute the posterior distribution p(q|n).
To apply the above results we must assume that
data at different loci are independent, so p(n|q)=∏p(nj|qj), and
the qj are a priori independent. This would imply, for example, that telling you q1 (the frequency of the 1 allele at locus 1) would not tell
you anything about q2 (the frequency of the 1 allele at locus 2).
In practice these are reasonable assumptions provided that the loci are well separated along the genome and the samples are taken from a well-mixing (“random-mating”) population of elephants without substructure.
Under these assumptions we have that the qj are a posteriori independent, with p(q|n)=∏jp(qj|nj).
Furthermore, we know from conjugacy that if the prior distribution on qj is a Beta distribution, say qj∼Beta(aj,bj), then the posterior p(qj|nj) is also a Beta distribution, with qj|nj∼Beta(aj+nj1,bj+nj0).
sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X El Capitan 10.11.6
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] backports_1.0.5 magrittr_1.5 rprojroot_1.2 htmltools_0.3.5
[5] tools_3.3.2 rstudioapi_0.6 yaml_2.1.14 Rcpp_0.12.9
[9] stringi_1.1.2 rmarkdown_1.3 knitr_1.15.1 git2r_0.18.0
[13] stringr_1.1.0 digest_0.6.12 workflowr_0.3.0 evaluate_0.10
This site was created with R Markdown