I recently started trying to learn Bayesian analysis, but I'm not yet confident that I understand the concepts, so I did the following example and wrote out my understanding of the concepts. I would appreciate it if people could please take the time to review it and and provide feedback as to whether my understanding is correct.
I have performed two experiments. In the first experiment, I had $173/323$ successes. In the second experiment, I had $125/198$ successes.
I modelled the first experiment as the binomial random variable $X_1$ with parameters $n_1$ and $p_1$. I modelled the second experiment as the binomial random variable $X_2$ with parameters $n_2$ and $p_2$. I hold $n_1$ and $n_2$ fixed.
I'm trying to get a Bayesian estimate for each of $p_1$ and $p_2$ and find the standard deviation of their posterior distributions.
I know that the family of beta distributions is the conjugate prior for the binomial distribution, so I use that as the prior for the parameters $p_1$ and $p_2$. The hyper-parameters were chosen to be $\alpha = 0.5$ and $\beta = 0.5$ (Jeffrey's prior).
If my understanding is correct, at this point, one is now ready to run simulations of these random variables.
To illustrate, in Stan, my model is as follows:
y1 ~ binomial(n1, p1); y2 ~ binomial(n2, p2); p1 ~ beta(alpha, beta); p2 ~ beta(alpha, beta);
My understanding is that the "posterior distribution" is the distribution of $p_1, p_2$, right? The point of what we're doing here -- in Bayesian analysis and simulation -- is to find the (posterior) distribution of some unknown values (in this case, $p_1, p_2$), using the prior distribution (in this case, the beta distribution), which reflects our beliefs about the posterior distribution before running the simulation?
- Is my understanding of this correct?
So, after running the simulation, the standard deviation of the posterior distributions of $p_1$ and $p_2$ would be the standard deviation of the distribution that was generated by the simulation?
- Is my understanding here correct?
After I ran this simulation, I got that $p_1$ has an approximate mean of $0.54$, with standard deviation of approximately $0.03$, and $p_2$ has an approximate mean of $0.63$, with standard deviation of approximately $0.03$ (but different from the standard deviation of $p_1$).
- Does this sound correct? And, if so, would I be correct in saying that these mean and standard deviation values are the mean and standard deviation values of the posterior distributions for $p1$ and $p_2$?