In Bayesian inference the following relationship is given between the posterior $P(\theta|X)$, the likelihood function $P(X|\theta)$ and the prior $P(\theta)$:

$$P(\theta|X) \propto P(X|\theta)P(\theta)$$

If the prior $P(\theta)$ is an improper uniform prior on $[-\infty,\infty]$ then does the Bayesian relationship simplify to:

$$P(\theta|X) \propto P(X|\theta)$$

If code is being written for the case of a uniform prior is it correct that the prior probability does not need to be coded?

In the case that $P(\theta)$ is uniform on $[L,U]$ can it be written (excuse my poor notation):

$$P(\theta|X) \propto P(\theta|X) \text{ for }L \leq X \leq U \text{, otherwise 0}$$

Again can the prior probability term need not be considered/coded?

  • $\begingroup$ It looks like you write $p(X)$ instead of $p(\theta)$. If no, your equations does not mean what you want to say. $\endgroup$
    – beuhbbb
    Feb 7, 2017 at 10:59
  • $\begingroup$ @peuhp My mistake. I meant $P(\theta)$. $\endgroup$
    – egg
    Feb 7, 2017 at 11:35

1 Answer 1


Assuming you wrote $p(X)$ for $p(\theta)$ then indeed in case of a uniform $p(\theta)$: $$ p(\theta|x) \propto p(x|\theta) $$ as $p(\theta)=\alpha>0$ for all $\theta$, falls into the constant term (that must not include quantities depending from $\theta$). In other words, as you stated, your posterior can be evaluated up to a constant term as $p(x|\theta)$.

When the uniform is bounded on a fixed interval, we indeed get: $$ p(\theta|x) \propto p(x|\theta) \mbox{ for } \theta \in [L,U] \mbox{and 0 else } $$ for the same reason than previous.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.