# Learn parameters for truncated Gaussian

I would like to learn the parameters for a truncated gaussian like this one.

I'm using this formula for the probability density $f(x | \mu, \sigma^2) = \exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right) \times \frac{1}{F(\mu, \sigma)}\times \mathbb{1}_{x>0}$

where $F(\mu, \sigma)$ is a function so that the integral of $f$ over $x$ equals $1$.

I tried to derive the maximum likelihood like we usually do for gaussian mixtures, but then I got stuck : I can't find an easy formula for $\mu$ and $\sigma$. How to find them?

• This histogram isn't Gaussian in appearance, truncated or not: its right tail is much too heavy. So: would you like answers to the question you asked or would you like advice about how to characterize the data you show? – whuber Dec 17 '16 at 18:59
• Thank you for your answer. I am trying to characterize the data. But I would be glad to hear an answer for the first question as well :) – Rosome Dec 17 '16 at 19:04
• what kind of data is this ? – IrishStat Dec 17 '16 at 19:15
• It is a histogram for a molecule concentration – Rosome Dec 17 '16 at 19:25
• taken over time or space ? or does it represent cross-sectional data – IrishStat Dec 17 '16 at 19:30

To be clear about what you written in your probability density function, this is a form of truncation. In other words, if $X < 0$, then $X$ does not appear in the data set. As such, it will not be described as a Gaussian Mixture Model.
When treating this as a maximum likelihood problem, there are no constraints on $\mu$ or $\log(\sigma)$. So vanilla optimization algorithms, like Newton Raphsons, should be able to optimize the likelihood without much problem.
Alternatively, if you really wanted to fit an EM algorithm, I believe you could do this by having the dropped $X$'s be your missing data. However, this will be a little tricky; your missing data will not just be values of unobserved $X$, but how many $X$'s are missing. The formula for the expected of number missing $X$'s would be $\frac{n}{1 - \Phi(-\mu / \sigma)} - n$. This will not be a whole number with probability 1!