# Computing posterior density

If I have two observations $$X=n,X=m$$, how do I then compute the posterior density? I can think of 2 ways but I don't know which one is the right one:

1) First compute posterior given $$X=n$$ $$p(\theta|X=n) = \frac{p(X=n|\theta)p(\theta)}{p(X=n)}$$

Then use this posterior as prior and compute the new posterior given $$X=m$$ $$p(\theta|X=m) = \frac{p(X=m|\theta)p(\theta|X=n)}{p(X=m)}$$

2) A joint probability approach like this: $$p(\theta|X=n,X=m) = \frac{p(X=n,X=m|\theta)p(\theta)}{p(X=n,X=m)}$$

• what is your observation? $X_1=n,X_2=m$ is your observation? – masoud Mar 31 '19 at 15:16
• @masoud Yes, I removed the index so that it is clear that $X_1$ and $X_2$ are not two different variables but rather 2 different time points (First observation and second observation.) – Matriz Mar 31 '19 at 15:25
• in method 2, in right side of equation , replace $p(\theta|X=n,X=m)$ with prior. – masoud Mar 31 '19 at 15:39

no one of them.

posterior: $$\pi(\theta | x_1,x_2)$$

prior: $$\pi (\theta)$$

likelihood: $$f(X|\theta)$$

$$\pi(\theta | x_1,x_2) =\frac{f(x_1,x_2|\theta) \pi(\theta)}{f(x_1,x_2)}$$

$$x_1,x_2$$ are your observation.

• Thanks. That was my method 2, but I accidently wrote the prior wrong. I somewhere read though that one can use the posterior as a new prior, do you know when this is the case? – Matriz Mar 31 '19 at 15:40