# bayesian posterior of truncated normal distribution with uniform prior

Let $N_T(\mu,\sigma)$ be a truncated normal distribution with support on $[0,1]$.

Draw $x \sim N_T(\mu,\sigma)$

(What I want to model is, I have a unknown quantity $\mu \in [0,1]$, but I only observe it with some noise.)

What is $p(\mu|x)$ with uniform prior on $[0,1]$?

\begin{align} p(\mu|x) & = \frac{p(x|\mu) p(\mu)}{\int p(x|\mu) p(\mu) \mathrm{d} \mu} \\ & \propto \frac{\phi(\frac{x - \mu}{\sigma})}{\sigma ( \Phi(\frac{1-\mu}{\sigma}) - \Phi(\frac{-\mu}{\sigma}) )} \mathbf{1}(0 \leq \mu \leq 1) \end{align}

$\phi(\cdot)$ is the standard normal distribution pdf. $\Phi(\cdot)$ is the standard normal distribution cdf.

Is $p(\mu|x)$ also a truncated normal distribution with different parameter? Similar to here? If not, what is it?

If I compute that $\displaystyle \int p(x|\mu)p(\mu) \mathrm{d} \mu$, I don't think I would get a constant which is same as a truncated normal distribution. Because $\mu$ is a variable in this case.

First, you can 'ignore' the integral in the denominator since this is just a constant assuring that the posterior is a density. In general $$p(\mu | x) \propto p(x|\mu)p(\mu).$$ As you have derived (note that $1/\sigma$ is a constant and is not considered): $$p(\mu|x) \propto \frac{\phi\left(\frac{x-\mu}{\sigma}\right)}{\Phi\left(\frac{1-\mu}{\sigma}\right) - \Phi\left(\frac{-\mu}{\sigma}\right)}I_{\mu \in [0,1]}.$$ At first glance it looks like it is a truncated normal again, however $\mu$ is now variable instead of $x$, so comparing with the truncated normal density, this is no longer the case.