$P(\theta|x)$ is the posterior probability. It describes $\textbf{how certain or confident we are that hypothesis $\theta$ is true, given that}$ we have observed data $x$.
Calculating posterior probabilities is the main goal of Bayesian statistics!
$P(\theta)$ is the prior probability, which describes $\textbf{how sure we were that}$ $\theta$ was true, before we observed the data $x$.
$P(x|\theta)$ is the likelihood. $\textbf{If you were to assume that $\theta$ is true, this is the probability}$ that you would have observed data $x$.
$P(x)$ is the marginal likelihood. This is the probability that you would have observed data $x$, whether $\theta$ is true or not.
So, $P (\theta|x) = \frac{P (\theta) P(x|\theta)}{P (x)}$
Now I don't undergraduate completely what $P(x)$ is the marginal likelihood is, could anyone plz explain with the motivation behind the term in simple language providing an example? Thanks you.
According to Bayes Theorem,
$$p(\mathbf{x})=\int_{\Theta}p(\theta)p(\mathbf{x}|\theta)d \theta$$
But in a bayesian point of view it is only a normalisation constant (as it is integrated in $d\theta$ it does not depends anymore by $\theta$)
Example: let's suppose to have a coin and suppose we have no idea if it is fair or not...so our prior distribution of the parameter $\theta$ is uniform in $[0;1]$.
Let's suppose to flip 10 times the coin obtaining 6 heads.
The likelihood is
$p(\mathbf{x}|\theta)\propto \theta ^6(1-\theta)^4$
As the prior density is 1, the previous function is also the posterior, unless an specific constant to be calculated (your $p(\mathbf{x})$).
Without a lot of calculations, you inmediately recognize a beta distribution
$$p(\theta|\mathbf{x})\sim Beta (7;5)$$
Thus the constant is
$$\frac{\Gamma(5+7)}{\Gamma(5)\Gamma(7)}=\frac{11!}{4!6!}=2310$$
Of course you can get the esame result solving the integral
$$\int_0^1\theta^6(1-\theta)^4 d \theta=\frac{1}{2310}$$