structural:summarization, stylistic:tone
With known mean

For a set of i.i.d. normally distributed data points X of size n where each individual point x follows x ∼ N (μ, σ 2) {\textstyle x\sim {\mathcal {N}}(\mu,\sigma ^{2})} with known mean μ, the conjugate prior of the variance has an inverse gamma distribution or a scaled inverse chi-squared distribution. The two are equivalent except for having different parameterizations. Although the inverse gamma is more commonly used, we use the scaled inverse chi-squared for the sake of convenience. The prior for σ is as follows:

p (σ 2 ∣ ν 0, σ 0 2) = (σ 0 2 ν 0 2) ν 0 / 2 Γ (ν 0 2) exp (σ 2) 1 + ν 0 2 ∝ exp (σ 2) 1 + ν 0 2 {\displaystyle p(\sigma ^{2}\mid \nu _{0},\sigma _{0}^{2})={\frac {(\sigma _{0}^{2}{\frac {\nu _{0}}{2}})^{\nu _{0}/2}}{\Gamma \left({\frac {\nu _{0}}{2}}\right)}}~{\frac {\exp \left}{(\sigma ^{2})^{1+{\frac {\nu _{0}}{2}}}}}\propto {\frac {\exp \left}{(\sigma ^{2})^{1+{\frac {\nu _{0}}{2}}}}}}

The likelihood function from above, written in terms of the variance, is:

p (X ∣ μ, σ 2) = (1 2 π σ 2) n / 2 exp = (1 2 π σ 2) n / 2 exp {\displaystyle {\begin{aligned}p(\mathbf {X} \mid \mu,\sigma ^{2})&=\left({\frac {1}{2\pi \sigma ^{2}}}\right)^{n/2}\exp \left\\&=\left({\frac {1}{2\pi \sigma ^{2}}}\right)^{n/2}\exp \left\end{aligned}}}

where

S = ∑ i = 1 n (x i − μ) 2. {\displaystyle S=\sum _{i=1}^{n}(x_{i}-\mu)^{2}.}

Then:

p (σ 2 ∣ X) ∝ p (X ∣ σ 2) p (σ 2) = (1 2 π σ 2) n / 2 exp (σ 0 2 ν 0 2) ν 0 2 Γ (ν 0 2) exp (σ 2) 1 + ν 0 2 ∝ (1 σ 2) n / 2 1 (σ 2) 1 + ν 0 2 exp = 1 (σ 2) 1 + ν 0 + n 2 exp {\displaystyle {\begin{aligned}p(\sigma ^{2}\mid \mathbf {X})&\propto p(\mathbf {X} \mid \sigma ^{2})p(\sigma ^{2})\\&=\left({\frac {1}{2\pi \sigma ^{2}}}\right)^{n/2}\exp \left{\frac {(\sigma _{0}^{2}{\frac {\nu _{0}}{2}})^{\frac {\nu _{0}}{2}}}{\Gamma \left({\frac {\nu _{0}}{2}}\right)}}~{\frac {\exp \left}{(\sigma ^{2})^{1+{\frac {\nu _{0}}{2}}}}}\\&\propto \left({\frac {1}{\sigma ^{2}}}\right)^{n/2}{\frac {1}{(\sigma ^{2})^{1+{\frac {\nu _{0}}{2}}}}}\exp \left\\&={\frac {1}{(\sigma ^{2})^{1+{\frac {\nu _{0}+n}{2}}}}}\exp \left\end{aligned}}}

The above is also a scaled inverse chi-squared distribution where

ν 0 ′ = ν 0 + n ν 0 ′ σ 0 2 ′ = ν 0 σ 0 2 + ∑ i = 1 n (x i − μ) 2 {\displaystyle {\begin{aligned}\nu _{0}'&=\nu _{0}+n\\\nu _{0}'{\sigma _{0}^{2}}'&=\nu _{0}\sigma _{0}^{2}+\sum _{i=1}^{n}(x_{i}-\mu)^{2}\end{aligned}}}

or equivalently

ν 0 ′ = ν 0 + n σ 0 2 ′ = ν 0 σ 0 2 + ∑ i = 1 n (x i − μ) 2 ν 0 + n {\displaystyle {\begin{aligned}\nu _{0}'&=\nu _{0}+n\\{\sigma _{0}^{2}}'&={\frac {\nu _{0}\sigma _{0}^{2}+\sum _{i=1}^{n}(x_{i}-\mu)^{2}}{\nu _{0}+n}}\end{aligned}}}

Reparameterizing in terms of an inverse gamma distribution, the result is:

α ′ = α + n 2 β ′ = β + ∑ i = 1 n (x i − μ) 2 2 {\displaystyle {\begin{aligned}\alpha '&=\alpha +{\frac {n}{2}}\\\beta '&=\beta +{\frac {\sum _{i=1}^{n}(x_{i}-\mu)^{2}}{2}}\end{aligned}}}