# I want the function that defines truncated lognormal distribution

Problem, I have a process(water level in chamber), it perfectly fits with lognormal. But the chamber has a maximum water level, after which no effect of water must be there.

I guess I can use the truncated lognormal distribution.

I have the following questions regarding truncated lognormal distribution

1. What are the PDF and CDF for truncated lognormal distribution.

Is there are closed form solution.

1. What aspects must I consider while working with truncated distributions.
2. If censoring the data points above the physical limit a senseful thing to do mathematically speaking.
• There seem to be multiple questions involved here! Please limit to one question per post. Commented Feb 26, 2023 at 21:39
• Are you sure it is truncated, rather than right censored? If it's truncated, then if Y (true value) is greater than some threshold, it's never seen in your dataset. If it's censored, then if it's greater than some threshold, you don't know the exact value, but just that it was above the threshold. If I understand your scenario, when Y is greater than some level, the system empties so you don't know what value you would hit if it were not emptied. But since you know it emptied at some trigger value, you should know the water level should be greater than or equal to the trigger value. Commented Feb 26, 2023 at 23:45
– whuber
Commented Feb 27, 2023 at 13:49

What are the PDF and CDF for truncated lognormal distribution.

Offhand, I don't know the CDF of a truncated log-normal either. But let me take a guess.

1. Start with a log-normal distribution. It has the CDF $$F(x;\mu, \sigma) = \frac{1}{2} \left[1 + \operatorname{erf} \left( \frac{\ln x - \mu}{\sigma \sqrt{2}} \right) \right]$$
2. Apply the truncation formula on the interval $$(a,b]$$ $$F(x| a < X \leq b]) = \frac{F(x) - F(a)}{F(b) - F(a)}$$ which by composition gives

\begin{align}F(x;\mu, \sigma | a < X \leq b) &= \frac{\frac{1}{2} \left[1 + \operatorname{erf} \left( \frac{\ln x - \mu}{\sigma \sqrt{2}} \right) \right] - \frac{1}{2} \left[1 + \operatorname{erf} \left( \frac{\ln a - \mu}{\sigma \sqrt{2}} \right) \right]}{\frac{1}{2} \left[1 + \operatorname{erf} \left( \frac{\ln b - \mu}{\sigma \sqrt{2}} \right) \right] - \frac{1}{2} \left[1 + \operatorname{erf} \left( \frac{\ln a - \mu}{\sigma \sqrt{2}} \right) \right]}\\&= \frac{ \left[1 + \operatorname{erf} \left( \frac{\ln x - \mu}{\sigma \sqrt{2}} \right) \right] - \left[1 + \operatorname{erf} \left( \frac{\ln a - \mu}{\sigma \sqrt{2}} \right) \right]}{ \left[1 + \operatorname{erf} \left( \frac{\ln b - \mu}{\sigma \sqrt{2}} \right) \right] - \left[1 + \operatorname{erf} \left( \frac{\ln a - \mu}{\sigma \sqrt{2}} \right) \right]}\\&= \frac{\operatorname{erf} \left( \frac{\ln x - \mu}{\sigma \sqrt{2}} \right) - \operatorname{erf} \left( \frac{\ln a - \mu}{\sigma \sqrt{2}} \right) }{ \operatorname{erf} \left( \frac{\ln b - \mu}{\sigma \sqrt{2}} \right) - \operatorname{erf} \left( \frac{\ln a - \mu}{\sigma \sqrt{2}} \right) }\end{align}

Assuming the above is correct, we can consider the derivative with respect to $$x$$ in order to obtain the derivative. Fortunately the error function has a derivative.

\begin{align}f(x;\mu, \sigma | a < X \leq b)& = \frac{\partial}{\partial x} F(x;\mu, \sigma | a < X \leq b)\\&= \frac{\partial}{\partial x} \left[ \frac{\operatorname{erf} \left( \frac{\ln x - \mu}{\sigma \sqrt{2}} \right) - \operatorname{erf} \left( \frac{\ln a - \mu}{\sigma \sqrt{2}} \right) }{ \operatorname{erf} \left( \frac{\ln b - \mu}{\sigma \sqrt{2}} \right) - \operatorname{erf} \left( \frac{\ln a - \mu}{\sigma \sqrt{2}} \right) } \right]\\&= \frac{ \frac{\partial}{\partial x} \operatorname{erf} \left( \frac{\ln x - \mu}{\sigma \sqrt{2}} \right)}{ \operatorname{erf} \left( \frac{\ln b - \mu}{\sigma \sqrt{2}} \right) - \operatorname{erf} \left( \frac{\ln a - \mu}{\sigma \sqrt{2}} \right) } \\&= \frac{ \frac{1}{x \sigma \sqrt{2 \pi}} \exp \left( - \frac{(\ln x - \mu)^2}{2 \sigma^2} \right) }{ \operatorname{erf} \left( \frac{\ln b - \mu}{\sigma \sqrt{2}} \right) - \operatorname{erf} \left( \frac{\ln a - \mu}{\sigma \sqrt{2}} \right) }\end{align}

Is there are closed form solution.

As Ben Bolker reminded me in the comments, it depends on what you're willing to allow as "closed form".

What aspects must I consider while working with truncated distributions.

Well, you've restricted the support to an interval so ensure that the set of possibilities you want to consider can fall within such an interval. And also since you started with the log-normal distribution, you should be mindful of the positivity constraint.

If censoring the data points above the physical limit a senseful thing to do mathematically speaking.

I am not sure I understand this aspect of the question. The upper bound $$b$$ being a physical limit should mean that you will never observe a measurement above that level. If you're referring to error in measurements leads to violations of the upper bound in the data, then you can attempt to account for that measurement error using something like an errors-in-variables model. But that's beyond the scope of what I was willing to put into this answer.

• Doesn't "closed form" depend on what class of special functions you permit? I can imagine a non-crazy definition of "closed form" that allowed special functions like erf() in addition to cos, sin, Gamma, etc. ... Commented Feb 26, 2023 at 22:06
• @BenBolker Yes, it does! I guess by default I assumed closed form to be an algebraic function. Nice catch. Commented Feb 26, 2023 at 22:08