# Estimating mean and st dev of a truncated gaussian curve without spike

Suppose I have a black box that generates data following a normal distribution with mean m and standard deviation s. Suppose, however, that whenever it outputs a value < 0 it does not record anything (can't even tell that it's outputted such a value). We have a truncated gaussian distribution without a spike.

How can I estimate these parameters?

-
I changed the tag from "truncated-gaussian" to "truncation" because most answers will be potentially useful in situations involving other distributions. – whuber Aug 23 '10 at 14:21

The model for your data would be:

$y_i \sim N(\mu,\sigma^2) I(y_i > 0)$

Thus, the density function is:

$$f(y_i|-) = \frac{exp(-\frac{(y_i-\mu)^2}{2 \sigma^2})}{\sqrt{2 \pi \sigma}\ (1 - \phi(-\frac{\mu}{\sigma}))}$$

where,

$\phi(.)$ is the standard normal cdf.

You can then estimate the parameters $\mu$ and $\sigma$ using either maximum likelihood or bayesian methods.

-

As Srikant Vadali has suggested, Cohen and Hald solved this problem using ML (with a Newton-Raphson root finder) around 1950. Another paper is Max Halperin's "Estimation in the Truncated Normal Distribution" available on JSTOR (for those with access). Googling "truncated gaussian estimation" produces lots of useful-looking hits.

-

With having a technical border TB for $a=0$ a simplified approach by H. Schneider is very usefull to calculate the mean $\mu_t$ and standard deviation $\sigma_t$ of the truncated normal distribution:

1. calculate the mean $\mu$ and the standard deviation $\sigma$ (entire population!) for the data set:

$\mu = \bar{x}= \frac{1}{n} \sum_{i=1}^{n}x_i$

$\sigma = s = \sqrt{\frac{1}{n} \sum_{i=1}^{n}(x_i-\bar{x})^2}$

2. check if the technical border $TB=a=0$ has a valid distance to the average $\bar{x}$:

consideration of $TB = a$ is not necessary when $\bar{x} \le 3s$

3. calculate $\omega, P_3(\omega), P_4(\omega)$ and $Q(\omega)$:

$\omega = \frac{s^2}{(a-\bar{x})^2}$

$P_3(\omega) = 1+5,74050101\omega - 13,53427037\omega^2 + 6,88665552\omega^3$

$P_4(\omega) = -0,00374615 + 0,17462558\omega - 2,87168509\omega^2 + 17,48932655\omega^3 - 11,91716546\omega^4$

$Q(\omega) = \frac{P_4(\omega)}{P_3(\omega)}$

4. check if $\omega \le 0,57081$, otherwise the mean $\mu_t$ is $<0$ which is not useful technically

5. calculate $\mu_t$ and $\sigma_t$ for the truncated normal distribution:

$\mu_t = \bar{x} + Q(\omega) \cdot (a-\bar{x})$

$\sigma_{t}^{2} = s^2 + Q(\omega) \cdot (a-\bar{x})^2$

That's all...

-