# How to calculate the mean of standard deviation when data are drawn from a Gaussian population?

This is a pure algebraic question. Drawing a sample of size $$n$$ from a Gaussian population $$N(0, \sigma^2)$$, the posterior probability of $$\sigma$$ is proportional to $$\frac{1}{\sigma^{n+1}} e^{-(s/\sigma)^2}$$, where s is the standard deviation of the sample. To get the mean standard deviation,

$$$$\begin{split} \langle\sigma^2\rangle & = C\int_0^\infty \sigma^2\sigma^{-n-1}e^{-n(s/\sigma)^2} \, d\sigma \\[8pt] & = \frac{ns^2}{n-2} \\[8pt] & = \frac{1}{n-2}\sum_i (x-\mu)^2 \end{split}$$$$

Does anyone have idea how the integral is made? It is not a regular integral that can be found in a common Gaussian integral table.

• consider a change of variable from $\sigma$ to $\xi=\sigma^{-2}$ Jul 10, 2019 at 12:18
• Proper notation is $\langle \sigma^2\rangle,$ not $<\sigma^2>.$ I edited accordingly. Jul 10, 2019 at 14:27
• One should not use the same symbol (in this case $\sigma$) for both the random variable and the variable with respect to which one integrates. I know that people in the physical sciences and engineering do this all the time, but nonetheless it is wrong and it actually prevents them from being able to do some routine things. Jul 10, 2019 at 14:31
• @Michael because the variable of integration is bound within the integral, there's no possibility of ambiguity except in cases (which would be unusual) where the random variable appears in the integrand.
– whuber
Jul 10, 2019 at 14:35
• @whuber : But one finds things like $\operatorname E(X\mid T)$ by finding $\operatorname E(X\mid T=t),$ and $\text{“} T=t \text{''}$ cannot be understood if it's written as $T=T$ or as $t=t. \qquad$ Jul 10, 2019 at 15:04

As Xi'an points out in comments, the substitution $$\xi=\sigma^{-2}$$ is called for. \begin{align} & \int_0^\infty \sigma^2\sigma^{-n-1}e^{-n(s/\sigma)^2} \, d\sigma \\[10pt] = {} & \int^0_\infty \xi^{-1} \xi^{(n+1)/2} e^{-ns^2\xi} \left( \frac{-\xi^{-3/2}\, d\xi} 2 \right) \\ & \qquad \text{where } \xi = \sigma^{-2} \\[10pt] = {} & \frac 1 2 \int_0^\infty \xi^{(n-4)/2} e^{-ns^2\xi} \, d\xi \\[8pt] = {} & \frac 1 2 \int_0^\infty \left( \frac \tau {ns^2} \right)^{(n-4)/2} e^{-\tau} \left( \frac{d\tau}{ns^2} \right) \\ & \qquad \text{where } \tau = ns^2 \xi \\[10pt] = {} & \frac 1 {2(ns^2)^{(n-2)/2}} \int_0^\infty \tau^{(n-2)/2 - 1} e^{-\tau} \, d\tau \\[8pt] = {} & \frac 1 {2(ns^2)^{(n-2)/2}} \Gamma\left( \frac{n-2} 2 \right). \end{align} One could of course do this as just one substitution: $$\tau = n(s/\sigma)^2.$$