1
$\begingroup$

I'm a Computer Science student currently studying Bayesian Statistics and I'm doing some simple simulations in R to become more familiar with the concepts.

Recently, I tried generating samples of data $X$ where $X|p\sim Be(p)$ and $p\sim \text{Unif}(0.25,0.4)$. This was done by generating random samples of $p$ and then using each random sample of $p$ to generate 1 sample of $X$.

I then used a uniform prior on $[0,1]$ and tried to recover the distribution of $p$ using Bayesian methods. But I ended up with a posterior distribution that has the bell curve-like shape centred at around $0.31$ instead of the true distribution of $p$ which should be $\text{Unif}(0.25,0.4)$.

Posterior distribution obtained

From what I was learning, it seems like Bayesian methods can have two interpretations – 1) where we use the prior to model the belief about the parameters but the parameters can be fixed and 2) where the parameters themselves follow some sort of a distribution. So why doesn't this work? Does this make sense theoretically? And does it have a link to hierarchical modeling as well?

$\endgroup$
1
  • 3
    $\begingroup$ Your model is doing inference on $p$, but it sounds like what you wanted to do was inference on $a,b$ the endpoints of the uniform distribution over values of $p \sim \text{Uniform}(a,b)$. In terms of inference about $p$, Bayes did the right thing here and assigned the highest density on $p$ between 0.25 and 0.4. $\endgroup$
    – Sycorax
    Commented Dec 20, 2021 at 18:05

1 Answer 1

1
$\begingroup$

In the Bayesian framework the prior is considered known and not something to be recovered. When you turn a prior into a posterior you condition on observed data. You correctly identified that a belief interpretation can be applied to both the prior and the posterior. This prior and posterior belief is in regards to the unknown fixed true $p$, before and after the data are observed.

When you selected $p$'s from $\text{Uniform}(0.25,0.4)$ and generated "observable" data, this represents a prior predictive distribution. It is not how the actual data generative process operates (because in truth $p$ is an unknown fixed constant), but the prior predictive distribution represents a prediction for a single as-of-yet unobserved $x$ based on not knowing the true $p$. It is predictive belief. Since the prior predictive distribution does not produce observable data, it is not something that would be used to construct a posterior.

If someone handed you a posterior and the observed data you could in principle reverse engineer the prior or something close to it, but the prior is considered known or given.

$\endgroup$
1
  • $\begingroup$ I see so it's because the parameters are supposed to be fixed. Thank you! $\endgroup$ Commented Dec 27, 2021 at 18:35

Your Answer

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

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