# Bayesian inference over an unknown variance

I am observing a random variable $X \in \mathbb{R}$ which can be assumed to be normally distributed with mean $\mu$ and variance $\sigma^2$. I am interested in fitting a posterior distribution over the unknown variance which, according to wikipedia, can be given in closed form by an inverse-gamma. My question is, given samples $\{x_1,...,x_n\}$ how can I fit this distribution, that is, calculate the parameters $\alpha$ and $\beta$?

edit:

I found this pdf, which gives the equations for the parameter updates, and much more relevant info.

• What's your prior? Note that working out the posterior distribution for a parameter is not generally called 'fitting a distribution' ... but 'computing a posterior'. Is this for some subject? – Glen_b Apr 29 '13 at 23:34
• Well, whatever is the appropriate conjugate prior, apparently the inverse gamma is used with an uniformed prior anyway. Just semantics I suppose, this is for a research project, as a comparison to other methods. – fairidox Apr 30 '13 at 2:41
• If you want a conjugate prior, the inverse gamma is it, since that's of the same form as the likelihood. Is this for some subject? – Glen_b Apr 30 '13 at 3:22
• You don't calculate priors from the data. They're priors. You use the data to update your prior information, giving posteriors. – Glen_b Apr 30 '13 at 6:53
• This classical problem is covered by standard Bayesian textbooks, eg our own Bayesian Core. – Xi'an Apr 30 '13 at 8:10

$\int \sigma^{-M+2}exp($$-a\over{2\sigma^2}$$)d\sigma \propto a^{-M\over2}$ is called the gamma-2 inverse step. Oftenly used when determining the distribution of the conditional posterior of $\sigma^2$.