Kernel of a density
Topic of Bayesian foundations, part of Bayesian statistics · Also in Conjugate analysis for normal models
Kernel of a density
| Type | Topic |
| Taught in | Bayesian foundations · Conjugate analysis for normal models |
| Part | Bayesian statistics |
| Questions using it | 59 |
The part of a density that depends on the variable, with every constant factor dropped. A posterior is computed as a kernel, p(\theta\mid y)\propto p(y\mid\theta)\,p(\theta), and recognising the kernel of a named family, such as \theta^{a-1}(1-\theta)^{b-1} for a Beta, identifies the posterior without computing its normalising constant.
In Bayesian foundations
From Bayesian foundations
Key idea
Bayesian calculation is the controlled multiplication of a likelihood by a prior, followed by normalisation or recognition of a known density kernel. The proportionality symbol removes constants in the variable being analysed, not arbitrary terms that still depend on that variable.
In Conjugate analysis for normal models
It is more useful to see how one might discover the prior than simply to be given its name. The unknown \sigma^2 is positive and continuous, and the likelihood kernel contains two distinctive pieces:
(\sigma^2)^{-n/2} \quad\text{and}\quad \exp\!\left\{-\frac{S_\mu/2}{\sigma^2}\right\}.
We therefore want a positive continuous density that already contains a power of \sigma^2 and an exponential in 1/\sigma^2.
The natural candidates can be rejected or repaired one at a time. An exponential density is positive and continuous, but its kernel e^{-\lambda\sigma^2} has \sigma^2, rather than 1/\sigma^2, in the exponent; with one rate parameter it also has its mode fixed at zero. A \chi^2 distribution is only a special Gamma distribution. A Gamma density for \sigma^2 contains (\sigma^2)^{a-1}e^{-b\sigma^2}, so both appearances of \sigma^2 point the wrong way. A Gamma density for the precision \tau=1/\sigma^2, however, has exactly the required structure. Transforming back gives the inverse-Gamma family.
Definition 1 (Inverse-Gamma distribution) In the shape–rate convention,
\sigma^2\sim\operatorname{InvGamma}(\alpha_0,\beta_0),
means that \sigma^2>0 has density
p(\sigma^2) =\frac{\beta_0^{\alpha_0}}{\Gamma(\alpha_0)} (\sigma^2)^{-\alpha_0-1} \exp\!\left(-\frac{\beta_0}{\sigma^2}\right).
This follows directly from the transformation \tau=1/\sigma^2\sim\operatorname{Gamma}(\alpha_0,\beta_0). Indeed,
\frac{\,\mathrm{d}\tau}{\,\mathrm{d}\sigma^2}=-\frac1{(\sigma^2)^2}, \qquad \left|\frac{\,\mathrm{d}\tau}{\,\mathrm{d}\sigma^2}\right| =\frac1{(\sigma^2)^2},
and therefore \begin{align*} p(\sigma^2) &=p_\tau(1/\sigma^2) \left|\frac{\,\mathrm{d}\tau}{\,\mathrm{d}\sigma^2}\right|\\ &=\frac{\beta_0^{\alpha_0}}{\Gamma(\alpha_0)} (1/\sigma^2)^{\alpha_0-1} e^{-\beta_0/\sigma^2} \frac1{(\sigma^2)^2}\\ &=\frac{\beta_0^{\alpha_0}}{\Gamma(\alpha_0)} (\sigma^2)^{-\alpha_0-1}e^{-\beta_0/\sigma^2}. \end{align*}
The posterior kernel is \begin{align*} p(\sigma^2\mid{\boldsymbol{x}}) &\propto p({\boldsymbol{x}}\mid\sigma^2)p(\sigma^2)\\ &\propto (\sigma^2)^{-n/2} e^{-S_\mu/(2\sigma^2)} (\sigma^2)^{-\alpha_0-1} e^{-\beta_0/\sigma^2}\\ &=(\sigma^2)^{-(\alpha_0+n/2)-1} \exp\!\left[-\frac{\beta_0+S_\mu/2}{\sigma^2}\right]. \end{align*}
Proposition 1 (Normal–inverse-Gamma variance update) Hence \boxed{ \sigma^2\mid{\boldsymbol{x}} \sim\operatorname{InvGamma}\!\left( \alpha_0+\frac n2, \beta_0+\frac12S_\mu \right)}.
For T\sim\operatorname{InvGamma}(a,b),
\mathbb{E}(T)=\frac b{a-1}\quad(a>1), \qquad \operatorname{mode}(T)=\frac b{a+1}.
The posterior mode is therefore \begin{align*} \widehat{\sigma^2}_{\mathrm{MAP}} &=\frac{\beta_0+S_\mu/2}{\alpha_0+n/2+1}\\ &=\frac{2\beta_0+S_\mu}{2(\alpha_0+1)+n}\\ &=\frac{2(\alpha_0+1)}{2(\alpha_0+1)+n} \frac{\beta_0}{\alpha_0+1} +\frac{n}{2(\alpha_0+1)+n} \frac{S_\mu}{n}. \end{align*} Thus, for the mode, the prior is equivalent to 2(\alpha_0+1) squared-deviation observations with total sum of squares 2\beta_0.
Always check the parameterisation before trusting a Gamma or inverse-Gamma formula. Shape–rate, shape–scale, variance, standard deviation, and precision conventions can produce expressions that look nearly identical while meaning different things. This is not a notational nuisance to wave away: it changes the numerical posterior.
Used in
- Taught in Bayesian foundations · Conjugate analysis for normal models
- Also used in The Beta–Binomial model · Conjugate analysis for normal models · Markov chains, Gibbs sampling, and Metropolis–Hastings · Bayesian hypotheses and model comparison · Exponential families and conjugacy · Hierarchical Bayes · Bayesian linear regression
- Questions that use it (59) — A geometric observation and a uniform prior (answer) · A logit-normal prior for a coin (answer) · Where did the probability go? · Find the prior rather than recalling it · Normal–inverse-\chi^2 conjugacy (answer) · A bivariate-normal Gibbs sampler (answer) · Metropolis–Hastings for the logit-normal posterior · An independent Gamma proposal (answer) · Fruit posterior · Make the simplex integral equal one · Reading conjugacy from a kernel · Conjugacy is not guaranteed by a name · Exponential observations parameterised by rate · Exponential observations parameterised by mean · The inverse-Gamma shape trap · Q1 (answer) · Q2 (answer) · Q4 (answer) · Q5 (answer) · Q6 (answer) · Q7 (answer) · Q9 (answer) · Q10 (answer) · Q12 · Q17 (answer) · Q22 · Q23 · Q24 (answer) · Q25 (answer) · Q26 · Q27 (answer) · Q28 (answer) · Q29 (answer) · Q42 · Q43 (answer) · Q48 · Q49 · Q50 (answer) · Q51 (answer) · Q52 (answer) · Q53 (answer) · Q58 (answer) · Q59 (answer) · Question 2 (answer) · Question 3 (answer) · Question 4 · Question 5 · Question 6 (answer) · Question 7 (answer) · Question 9 (answer) · Question 10 (answer) · Question 11 (answer) · Question 12 · Question 13 · Question 14 (answer) · Question 16 (answer) · Question 17 (answer) · Question 18 (answer) · C10
- All 15 questions on Bayesian foundations
See also
Kernel · Kernel density estimator · Gaussian kernel · A proper approximation to the flat prior · Conjugacy is optional · Marginal hyperposterior · Normal hierarchical shrinkage · Bayesian credible interval